Class List Method List File List

# Class: VertxWeb::BodyHandler

Inherits:
  Object
  - Object
  - VertxWeb::BodyHandler
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/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(uploadDirectory = nil)
  Create a body handler and use the given upload directory.

## Instance Method Summary (collapse)

- - (void) handle(arg0 = nil)
- - (self) set_body_limit(bodyLimit = nil)
  Set the maximum body size -1 means unlimited.
- - (self) set_delete_uploaded_files_on_end(deleteUploadedFilesOnEnd = nil)
  Set whether uploaded files should be removed after handling the request.
- - (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(uploadDirectory = nil)

Create a body handler and use the given upload directory.

Parameters:

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

Returns:

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

Raises:

- (`ArgumentError`)

    30
    31
    32
    33
    34
    35
    36
    37
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 30

    def self.create(uploadDirectory=nil)
      if !block_given? && uploadDirectory == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::BodyHandler.java_method(:create, []).call(),::VertxWeb::BodyHandler)
      elsif uploadDirectory.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::BodyHandler.java_method(:create, [Java::java.lang.String.java_class]).call(uploadDirectory),::VertxWeb::BodyHandler)
      end
      raise ArgumentError, "Invalid arguments when calling create(uploadDirectory)"
    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-stack/stack-docs/target/rb/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`)

    41
    42
    43
    44
    45
    46
    47
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 41

    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_delete_uploaded_files_on_end(deleteUploadedFilesOnEnd = nil)

Set whether uploaded files should be removed after handling the request

Parameters:

- deleteUploadedFilesOnEnd (`true`, `false`) (defaults to: `nil`) —
  true if uploaded files should be removed after handling the request

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    71
    72
    73
    74
    75
    76
    77
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 71

    def set_delete_uploaded_files_on_end(deleteUploadedFilesOnEnd=nil)
      if (deleteUploadedFilesOnEnd.class == TrueClass || deleteUploadedFilesOnEnd.class == FalseClass) && !block_given?
        @j_del.java_method(:setDeleteUploadedFilesOnEnd, [Java::boolean.java_class]).call(deleteUploadedFilesOnEnd)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_delete_uploaded_files_on_end(deleteUploadedFilesOnEnd)"
    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`)

    61
    62
    63
    64
    65
    66
    67
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 61

    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`)

    51
    52
    53
    54
    55
    56
    57
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 51

    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