Class: VertxWeb::BodyHandler
- Inherits:
-
Object
- Object
- VertxWeb::BodyHandler
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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)
- + (Boolean) accept?(obj)
-
+ (::VertxWeb::BodyHandler) create(param_1 = nil)
Create a body handler and use the given upload directory.
-
+ (Object) DEFAULT_BODY_LIMIT
Default max size for a request body.
-
+ (Object) DEFAULT_DELETE_UPLOADED_FILES_ON_END
Default value of whether uploaded files should be removed after handling the request.
-
+ (Object) DEFAULT_MERGE_FORM_ATTRIBUTES
Default value of whether form attributes should be merged into request params.
-
+ (Object) DEFAULT_PREALLOCATE_BODY_BUFFER
Default value of whether to pre-allocate the body buffer size according to the content-length HTTP request header.
-
+ (Object) DEFAULT_UPLOADS_DIRECTORY
Default uploads directory on server for file uploads.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) handle(event = nil)
Something has happened, so handle it.
-
- (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_handle_file_uploads(handleFileUploads = nil)
Set whether file uploads will be handled.
-
- (self) set_merge_form_attributes(mergeFormAttributes = nil)
Set whether form attributes will be added to the request parameters.
-
- (self) set_preallocate_body_buffer(isPreallocateBodyBuffer = nil)
Pre-allocate the body buffer according to the value parsed from content-length header.
-
- (self) set_uploads_directory(uploadsDirectory = nil)
Set the uploads directory to use.
Class Method Details
+ (Boolean) accept?(obj)
20 21 22 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 20 def @@j_api_type.accept?(obj) obj.class == BodyHandler end |
+ (::VertxWeb::BodyHandler) create + (::VertxWeb::BodyHandler) create(handleFileUploads) + (::VertxWeb::BodyHandler) create(uploadDirectory)
Create a body handler and use the given upload directory.
51 52 53 54 55 56 57 58 59 60 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 51 def self.create(param_1=nil) if !block_given? && param_1 == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::BodyHandler.java_method(:create, []).call(),::VertxWeb::BodyHandler) elsif (param_1.class == TrueClass || param_1.class == FalseClass) && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::BodyHandler.java_method(:create, [Java::boolean.java_class]).call(param_1),::VertxWeb::BodyHandler) elsif param_1.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandler::BodyHandler.java_method(:create, [Java::java.lang.String.java_class]).call(param_1),::VertxWeb::BodyHandler) end raise ArgumentError, "Invalid arguments when calling create(#{param_1})" end |
+ (Object) DEFAULT_BODY_LIMIT
Default max size for a request body. -1 means unlimited
123 124 125 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 123 def self.DEFAULT_BODY_LIMIT Java::IoVertxExtWebHandler::BodyHandler.DEFAULT_BODY_LIMIT end |
+ (Object) DEFAULT_DELETE_UPLOADED_FILES_ON_END
Default value of whether uploaded files should be removed after handling the request
135 136 137 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 135 def self.DEFAULT_DELETE_UPLOADED_FILES_ON_END Java::IoVertxExtWebHandler::BodyHandler.DEFAULT_DELETE_UPLOADED_FILES_ON_END end |
+ (Object) DEFAULT_MERGE_FORM_ATTRIBUTES
Default value of whether form attributes should be merged into request params
131 132 133 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 131 def self.DEFAULT_MERGE_FORM_ATTRIBUTES Java::IoVertxExtWebHandler::BodyHandler.DEFAULT_MERGE_FORM_ATTRIBUTES end |
+ (Object) DEFAULT_PREALLOCATE_BODY_BUFFER
Default value of whether to pre-allocate the body buffer size according to the content-length HTTP request header
139 140 141 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 139 def self.DEFAULT_PREALLOCATE_BODY_BUFFER Java::IoVertxExtWebHandler::BodyHandler.DEFAULT_PREALLOCATE_BODY_BUFFER end |
+ (Object) DEFAULT_UPLOADS_DIRECTORY
Default uploads directory on server for file uploads
127 128 129 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 127 def self.DEFAULT_UPLOADS_DIRECTORY Java::IoVertxExtWebHandler::BodyHandler.DEFAULT_UPLOADS_DIRECTORY end |
+ (Object) j_api_type
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 23 def @@j_api_type.wrap(obj) BodyHandler.new(obj) end |
Instance Method Details
- (void) handle(event = nil)
This method returns an undefined value.
Something has happened, so handle it.
38 39 40 41 42 43 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 38 def handle(event=nil) if event.class.method_defined?(:j_del) && !block_given? return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(event.j_del) end raise ArgumentError, "Invalid arguments when calling handle(#{event})" end |
- (self) set_body_limit(bodyLimit = nil)
Set the maximum body size -1 means unlimited
74 75 76 77 78 79 80 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 74 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
104 105 106 107 108 109 110 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 104 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_handle_file_uploads(handleFileUploads = nil)
Set whether file uploads will be handled
64 65 66 67 68 69 70 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 64 def set_handle_file_uploads(handleFileUploads=nil) if (handleFileUploads.class == TrueClass || handleFileUploads.class == FalseClass) && !block_given? @j_del.java_method(:setHandleFileUploads, [Java::boolean.java_class]).call(handleFileUploads) return self end raise ArgumentError, "Invalid arguments when calling set_handle_file_uploads(#{handleFileUploads})" end |
- (self) set_merge_form_attributes(mergeFormAttributes = nil)
Set whether form attributes will be added to the request parameters
94 95 96 97 98 99 100 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 94 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_preallocate_body_buffer(isPreallocateBodyBuffer = nil)
Pre-allocate the body buffer according to the value parsed from content-length header.
The buffer is capped at 64KB
115 116 117 118 119 120 121 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 115 def set_preallocate_body_buffer(isPreallocateBodyBuffer=nil) if (isPreallocateBodyBuffer.class == TrueClass || isPreallocateBodyBuffer.class == FalseClass) && !block_given? @j_del.java_method(:setPreallocateBodyBuffer, [Java::boolean.java_class]).call(isPreallocateBodyBuffer) return self end raise ArgumentError, "Invalid arguments when calling set_preallocate_body_buffer(#{isPreallocateBodyBuffer})" end |
- (self) set_uploads_directory(uploadsDirectory = nil)
Set the uploads directory to use
84 85 86 87 88 89 90 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web/body_handler.rb', line 84 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 |