Package io.vertx.mutiny.ext.web.handler
Class BodyHandler
java.lang.Object
io.vertx.mutiny.ext.web.handler.BodyHandler
- All Implemented Interfaces:
MutinyDelegate,io.vertx.core.Handler<RoutingContext>,Consumer<RoutingContext>
public class BodyHandler
extends Object
implements io.vertx.core.Handler<RoutingContext>, Consumer<RoutingContext>, MutinyDelegate
A handler which gathers the entire request body and sets it on the
RoutingContext.
It also handles HTTP file uploads and can be used to limit body sizes.
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
- Author:
- Tim Fox
- See Also:
-
BodyHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypeArg<BodyHandler>static final longDefault max size for a request body in bytes =10485760, i.e. 10 megabytesstatic final booleanDefault value of whether uploaded files should be removed after handling the requeststatic final booleanDefault value of whether form attributes should be merged into request paramsstatic final booleanDefault value of whether to pre-allocate the body buffer size according to the content-length HTTP request headerstatic final StringDefault uploads directory on server for file uploads -
Constructor Summary
ConstructorsConstructorDescriptionBodyHandler(io.vertx.ext.web.handler.BodyHandler delegate) Create a new instance ofBodyHandlerdelegating to the given (non-null) instance ofBodyHandler.BodyHandler(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(RoutingContext item) Handle an item.static BodyHandlercreate()Create a body handler with defaults.static BodyHandlercreate(boolean handleFileUploads) Create a body handler setting if it should handle file uploads.static BodyHandlerCreate a body handler and use the given upload directory.booleanio.vertx.ext.web.handler.BodyHandlerGet the delegate instance.voidhandle(RoutingContext item) Handle an item.inthashCode()static BodyHandlernewInstance(io.vertx.ext.web.handler.BodyHandler delegate) Creates a new instance of theBodyHandler.setBodyLimit(long bodyLimit) Set the maximum body size in bytes,-1means no limit.setDeleteUploadedFilesOnEnd(boolean deleteUploadedFilesOnEnd) Set whether uploaded files should be removed after handling the request.setHandleFileUploads(boolean handleFileUploads) Set whether file uploads will be handled.setMergeFormAttributes(boolean mergeFormAttributes) Set whether form attributes will be added to the request parameters.setPreallocateBodyBuffer(boolean isPreallocateBodyBuffer) Pre-allocate the body buffer according to the value parsed from content-length header.setUploadsDirectory(String uploadsDirectory) Set the uploads directory to use.toString()
-
Field Details
-
DEFAULT_BODY_LIMIT
public static final long DEFAULT_BODY_LIMITDefault max size for a request body in bytes =10485760, i.e. 10 megabytes- See Also:
-
DEFAULT_UPLOADS_DIRECTORY
Default uploads directory on server for file uploads- See Also:
-
DEFAULT_MERGE_FORM_ATTRIBUTES
public static final boolean DEFAULT_MERGE_FORM_ATTRIBUTESDefault value of whether form attributes should be merged into request params- See Also:
-
DEFAULT_DELETE_UPLOADED_FILES_ON_END
public static final boolean DEFAULT_DELETE_UPLOADED_FILES_ON_ENDDefault value of whether uploaded files should be removed after handling the request- See Also:
-
DEFAULT_PREALLOCATE_BODY_BUFFER
public static final boolean DEFAULT_PREALLOCATE_BODY_BUFFERDefault value of whether to pre-allocate the body buffer size according to the content-length HTTP request header- See Also:
-
__TYPE_ARG
-
-
Constructor Details
-
BodyHandler
public BodyHandler(io.vertx.ext.web.handler.BodyHandler delegate) Create a new instance ofBodyHandlerdelegating to the given (non-null) instance ofBodyHandler. -
BodyHandler
-
-
Method Details
-
accept
Handle an item. This method is generated from theoriginalmethod."- Specified by:
acceptin interfaceConsumer<RoutingContext>
-
handle
Handle an item. This method is generated from theoriginalmethod."- Specified by:
handlein interfaceio.vertx.core.Handler<RoutingContext>
-
getDelegate
public io.vertx.ext.web.handler.BodyHandler getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate instance
-
create
Create a body handler with defaults.- Returns:
- the body handler
-
create
Create a body handler setting if it should handle file uploads.- Parameters:
handleFileUploads- true if files upload should be handled- Returns:
- the body handler
-
create
Create a body handler and use the given upload directory.- Parameters:
uploadDirectory- the uploads directory- Returns:
- the body handler
-
setHandleFileUploads
Set whether file uploads will be handled.- Parameters:
handleFileUploads- true if they should be handled- Returns:
- reference to this for fluency
-
setBodyLimit
Set the maximum body size in bytes,-1means no limit.- Parameters:
bodyLimit- the max size in bytes- Returns:
- reference to this for fluency
-
setUploadsDirectory
Set the uploads directory to use.- Parameters:
uploadsDirectory- the uploads directory- Returns:
- reference to this for fluency
-
setMergeFormAttributes
Set whether form attributes will be added to the request parameters.- Parameters:
mergeFormAttributes- true if they should be merged- Returns:
- reference to this for fluency
-
setDeleteUploadedFilesOnEnd
Set whether uploaded files should be removed after handling the request.- Parameters:
deleteUploadedFilesOnEnd- true if uploaded files should be removed after handling the request- Returns:
- reference to this for fluency
-
setPreallocateBodyBuffer
Pre-allocate the body buffer according to the value parsed from content-length header. The buffer is capped at 64KB- Parameters:
isPreallocateBodyBuffer-trueif body buffer is pre-allocated according to the size read from content-length Header. {code false} if body buffer is pre-allocated to 1KB, and is resized dynamically- Returns:
- reference to this for fluency
-
newInstance
Creates a new instance of theBodyHandler. -
hashCode
public int hashCode() -
equals
-
toString
-