Class MultiPartProperties
java.lang.Object
org.glassfish.jersey.media.multipart.MultiPartProperties
Injectable JavaBean containing the configuration parameters for
jersey-multipart
as used in this particular application.- Author:
- Craig McClanahan, Paul Sandoz, Michal Gajdos
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Name of the resource property for the threshold size (in bytes) above which a body part entity will be buffered to disk instead of being held in memory.static final int
TheBUFFER_THRESHOLD
property value to keep a body part entity in memory only.static final int
Default threshold size for buffer.static final String
Limit the maximum number of parts the multipart entity can have.static final String
Name of a properties resource that (if found in the classpath for this application) will be used to configure the settings returned by our getter methods.static final String
Name of the resource property for the directory to store temporary files containing body parts of multipart message that extends allowed memory threshold. -
Constructor Summary
ConstructorDescriptionLoad and customize (if necessary) the configuration values for thejersey-multipart
injection binder. -
Method Summary
Modifier and TypeMethodDescriptionbufferThreshold
(int threshold) Set the size (in bytes) of the entity of an incomingBodyPart
before it will be buffered to disk.int
Get the size (in bytes) of the entity of an incomingBodyPart
before it will be buffered to disk.int
Return maximum number of entity parts allowed.Get the directory to store temporary files containing body parts of multipart message that extends allowed memory threshold.maxParts
(int maxParts) Set the maximum number of received parts of a multipart entity.resolver()
Create acontext resolver
for a current state of thisMultiPartProperties
.Set the path to the directory to store temporary files containing body parts of multipart message that extends allowed memory threshold.
-
Field Details
-
DEFAULT_BUFFER_THRESHOLD
public static final int DEFAULT_BUFFER_THRESHOLDDefault threshold size for buffer. -
MULTI_PART_CONFIG_RESOURCE
Name of a properties resource that (if found in the classpath for this application) will be used to configure the settings returned by our getter methods.
The resource name is
jersey-multipart-config.properties
.- See Also:
-
BUFFER_THRESHOLD
Name of the resource property for the threshold size (in bytes) above which a body part entity will be buffered to disk instead of being held in memory. The default value isDEFAULT_BUFFER_THRESHOLD
.- See Also:
-
BUFFER_THRESHOLD_MEMORY_ONLY
public static final int BUFFER_THRESHOLD_MEMORY_ONLYTheBUFFER_THRESHOLD
property value to keep a body part entity in memory only.- See Also:
-
MAX_PARTS
Limit the maximum number of parts the multipart entity can have. If the limit is over, the error response status
Response.Status.REQUEST_ENTITY_TOO_LARGE
is returned.By default, the number is unlimited.
- Since:
- 2.44
- See Also:
-
TEMP_DIRECTORY
Name of the resource property for the directory to store temporary files containing body parts of multipart message that extends allowed memory threshold. The default value is not set (will be taken fromjava.io.tmpdir
system property).- See Also:
-
-
Constructor Details
-
MultiPartProperties
public MultiPartProperties()Load and customize (if necessary) the configuration values for thejersey-multipart
injection binder.- Throws:
IllegalArgumentException
- if the configuration resource exists, but there are problems reading it
-
-
Method Details
-
getBufferThreshold
public int getBufferThreshold()Get the size (in bytes) of the entity of an incomingBodyPart
before it will be buffered to disk. If not customized, the default value is 4096.- Returns:
- return threshold size for starting to buffer the incoming entity to disk.
-
getTempDir
Get the directory to store temporary files containing body parts of multipart message that extends allowed memory threshold.- Returns:
- path to the temporary directory.
- Since:
- 2.4.1
-
getMaxParts
public int getMaxParts()Return maximum number of entity parts allowed.- Returns:
- maximum number of parts.
- Since:
- 2.44
-
bufferThreshold
Set the size (in bytes) of the entity of an incomingBodyPart
before it will be buffered to disk.- Parameters:
threshold
- size of body part.- Returns:
MultiPartProperties
instance.- Since:
- 2.4.1
-
tempDir
Set the path to the directory to store temporary files containing body parts of multipart message that extends allowed memory threshold.- Parameters:
path
- path to the temporary directory.- Returns:
MultiPartProperties
instance.- Since:
- 2.4.1
-
maxParts
Set the maximum number of received parts of a multipart entity.- Parameters:
maxParts
- The maximum number of entity parts.- Returns:
MultiPartProperties
instance.- Since:
- 2.44
-
resolver
Create acontext resolver
for a current state of thisMultiPartProperties
.- Returns:
- context resolver for this config.
- Since:
- 2.4.1
-