Class List Method List File List

# Class: VertxWeb::BodyHandler

Inherits:
  Object
  - Object
  - VertxWeb::BodyHandler
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-web/vertx-web/src/main/resources/vertx-web/body_handler.rb

## Overview

A handler which gathers the entire request body and sets it on the .

It also handles HTTP file uploads and can be used to limit body sizes.

## Class Method Summary (collapse)

- + (::VertxWeb::BodyHandler) create
  Create a body handler with defaults.

## Instance Method Summary (collapse)

- - (void) handle(arg0 = nil)
- - (self) set_body_limit(bodyLimit = nil)
  Set the maximum body size -1 means unlimited.
- - (self) set_merge_form_attributes(mergeFormAttributes = nil)
  Set whether form attributes will be added to the request parameters.
- - (self) set_uploads_directory(uploadsDirectory = nil)
  Set the uploads directory to use.

## Class Method Details

### + (`::VertxWeb::BodyHandler`) create

Create a body handler with defaults

Returns:

- (`::VertxWeb::BodyHandler`) —
  the body handler

Raises:

- (`ArgumentError`)

    29
    30
    31
    32
    33
    34
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/vertx-web/src/main/resources/vertx-web/body_handler.rb', line 29

    def self.create
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::BodyHandler.java_method(:create, []).call(),::VertxWeb::BodyHandler)
      end
      raise ArgumentError, "Invalid arguments when calling create()"
    end

## Instance Method Details

### - (`void`) handle(arg0 = nil)

This method returns an undefined value.

Parameters:

- arg0 (`::VertxWeb::RoutingContext`) (defaults to: `nil`)

Raises:

- (`ArgumentError`)

    21
    22
    23
    24
    25
    26
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/vertx-web/src/main/resources/vertx-web/body_handler.rb', line 21

    def handle(arg0=nil)
      if arg0.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(arg0.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling handle(arg0)"
    end

### - (`self`) set_body_limit(bodyLimit = nil)

Set the maximum body size -1 means unlimited

Parameters:

- bodyLimit (`Fixnum`) (defaults to: `nil`) —
  the max size

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    38
    39
    40
    41
    42
    43
    44
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/vertx-web/src/main/resources/vertx-web/body_handler.rb', line 38

    def set_body_limit(bodyLimit=nil)
      if bodyLimit.class == Fixnum && !block_given?
        @j_del.java_method(:setBodyLimit, [Java::long.java_class]).call(bodyLimit)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_body_limit(bodyLimit)"
    end

### - (`self`) set_merge_form_attributes(mergeFormAttributes = nil)

Set whether form attributes will be added to the request parameters

Parameters:

- mergeFormAttributes (`true`, `false`) (defaults to: `nil`) —
  true if they should be merged

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    58
    59
    60
    61
    62
    63
    64
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/vertx-web/src/main/resources/vertx-web/body_handler.rb', line 58

    def set_merge_form_attributes(mergeFormAttributes=nil)
      if (mergeFormAttributes.class == TrueClass || mergeFormAttributes.class == FalseClass) && !block_given?
        @j_del.java_method(:setMergeFormAttributes, [Java::boolean.java_class]).call(mergeFormAttributes)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_merge_form_attributes(mergeFormAttributes)"
    end

### - (`self`) set_uploads_directory(uploadsDirectory = nil)

Set the uploads directory to use

Parameters:

- uploadsDirectory (`String`) (defaults to: `nil`) —
  the uploads directory

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    48
    49
    50
    51
    52
    53
    54
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-web/vertx-web/src/main/resources/vertx-web/body_handler.rb', line 48

    def set_uploads_directory(uploadsDirectory=nil)
      if uploadsDirectory.class == String && !block_given?
        @j_del.java_method(:setUploadsDirectory, [Java::java.lang.String.java_class]).call(uploadsDirectory)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_uploads_directory(uploadsDirectory)"
    end