public class BodyHandler extends Object implements Handler<RoutingContext>
It also handles HTTP file uploads and can be used to limit body sizes.
NOTE: This class has been automatically generated from theoriginal
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<BodyHandler> |
__TYPE_ARG |
static long |
DEFAULT_BODY_LIMIT
Default max size for a request body =
-1 means unlimited |
static boolean |
DEFAULT_DELETE_UPLOADED_FILES_ON_END
Default value of whether uploaded files should be removed after handling the request
|
static boolean |
DEFAULT_MERGE_FORM_ATTRIBUTES
Default value of whether form attributes should be merged into request params
|
static boolean |
DEFAULT_PREALLOCATE_BODY_BUFFER
Default value of whether to pre-allocate the body buffer size according to the content-length HTTP request header
|
static String |
DEFAULT_UPLOADS_DIRECTORY
Default uploads directory on server for file uploads
|
Constructor and Description |
---|
BodyHandler(BodyHandler delegate) |
BodyHandler(Object delegate) |
Modifier and Type | Method and Description |
---|---|
static BodyHandler |
create()
Create a body handler with defaults
|
static BodyHandler |
create(boolean handleFileUploads)
Create a body handler setting if it should handle file uploads
|
static BodyHandler |
create(String uploadDirectory)
Create a body handler and use the given upload directory.
|
boolean |
equals(Object o) |
BodyHandler |
getDelegate() |
void |
handle(RoutingContext event)
Something has happened, so handle it.
|
int |
hashCode() |
static BodyHandler |
newInstance(BodyHandler arg) |
BodyHandler |
setBodyLimit(long bodyLimit)
Set the maximum body size in bytes,
-1 means no limit |
BodyHandler |
setDeleteUploadedFilesOnEnd(boolean deleteUploadedFilesOnEnd)
Set whether uploaded files should be removed after handling the request
|
BodyHandler |
setHandleFileUploads(boolean handleFileUploads)
Set whether file uploads will be handled
|
BodyHandler |
setMergeFormAttributes(boolean mergeFormAttributes)
Set whether form attributes will be added to the request parameters
|
BodyHandler |
setPreallocateBodyBuffer(boolean isPreallocateBodyBuffer)
Pre-allocate the body buffer according to the value parsed from content-length header.
|
BodyHandler |
setUploadsDirectory(String uploadsDirectory)
Set the uploads directory to use
|
String |
toString() |
public static final io.vertx.lang.rx.TypeArg<BodyHandler> __TYPE_ARG
public static final long DEFAULT_BODY_LIMIT
-1
means unlimitedpublic static final String DEFAULT_UPLOADS_DIRECTORY
public static final boolean DEFAULT_MERGE_FORM_ATTRIBUTES
public static final boolean DEFAULT_DELETE_UPLOADED_FILES_ON_END
public static final boolean DEFAULT_PREALLOCATE_BODY_BUFFER
public BodyHandler(BodyHandler delegate)
public BodyHandler(Object delegate)
public BodyHandler getDelegate()
public void handle(RoutingContext event)
handle
in interface Handler<RoutingContext>
event
- the event to handlepublic static BodyHandler create()
public static BodyHandler create(boolean handleFileUploads)
handleFileUploads
- true if files upload should be handledpublic static BodyHandler create(String uploadDirectory)
uploadDirectory
- the uploads directorypublic BodyHandler setHandleFileUploads(boolean handleFileUploads)
handleFileUploads
- true if they should be handledpublic BodyHandler setBodyLimit(long bodyLimit)
-1
means no limitbodyLimit
- the max size in bytespublic BodyHandler setUploadsDirectory(String uploadsDirectory)
uploadsDirectory
- the uploads directorypublic BodyHandler setMergeFormAttributes(boolean mergeFormAttributes)
mergeFormAttributes
- true if they should be mergedpublic BodyHandler setDeleteUploadedFilesOnEnd(boolean deleteUploadedFilesOnEnd)
deleteUploadedFilesOnEnd
- true if uploaded files should be removed after handling the requestpublic BodyHandler setPreallocateBodyBuffer(boolean isPreallocateBodyBuffer)
isPreallocateBodyBuffer
- true
if 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 dynamicallypublic static BodyHandler newInstance(BodyHandler arg)
Copyright © 2023 Eclipse. All rights reserved.