Class: VertxWeb::BodyHandler

Inherits:
Object
  • Object
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.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


20
21
22
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 20

def @@j_api_type.accept?(obj)
  obj.class == BodyHandler
end

+ (::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:

Raises:

  • (ArgumentError)


46
47
48
49
50
51
52
53
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 46

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

+ (Object) j_api_type



29
30
31
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 29

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

def self.j_class
  Java::IoVertxExtWebHandler::BodyHandler.java_class
end

+ (Object) unwrap(obj)



26
27
28
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 26

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



23
24
25
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 23

def @@j_api_type.wrap(obj)
  BodyHandler.new(obj)
end

Instance Method Details

- (void) handle(arg0 = nil)

This method returns an undefined value.

Parameters:

Raises:

  • (ArgumentError)


37
38
39
40
41
42
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 37

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)


57
58
59
60
61
62
63
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 57

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)


87
88
89
90
91
92
93
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 87

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)


77
78
79
80
81
82
83
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 77

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)


67
68
69
70
71
72
73
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/body_handler.rb', line 67

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