Class MultiPartProperties
- java.lang.Object
-
- org.glassfish.jersey.media.multipart.MultiPartProperties
-
public class MultiPartProperties extends java.lang.Object
Injectable JavaBean containing the configuration parameters forjersey-multipart
as used in this particular application.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
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.static int
BUFFER_THRESHOLD_MEMORY_ONLY
TheBUFFER_THRESHOLD
property value to keep a body part entity in memory only.private int
bufferThreshold
The threshold size (in bytes) above which a body part entity will be buffered to disk instead of being held in memory.static int
DEFAULT_BUFFER_THRESHOLD
Default threshold size for buffer.static java.lang.String
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.static java.lang.String
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..private java.lang.String
tempDir
Directory to store temporary files containing body parts of multipart message that extends allowed memory threshold.
-
Constructor Summary
Constructors Constructor Description MultiPartProperties()
Load and customize (if necessary) the configuration values for thejersey-multipart
injection binder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiPartProperties
bufferThreshold(int threshold)
Set the size (in bytes) of the entity of an incomingBodyPart
before it will be buffered to disk.private void
configure()
Configure the values returned by this instance's getters based on the contents of a properties resource, if it exists on the classpath for this application.int
getBufferThreshold()
Get the size (in bytes) of the entity of an incomingBodyPart
before it will be buffered to disk.java.lang.String
getTempDir()
Get the directory to store temporary files containing body parts of multipart message that extends allowed memory threshold.javax.ws.rs.ext.ContextResolver<MultiPartProperties>
resolver()
Create acontext resolver
for a current state of thisMultiPartProperties
.MultiPartProperties
tempDir(java.lang.String path)
Set the path to the directory to store temporary files containing body parts of multipart message that extends allowed memory threshold.
-
-
-
Field Detail
-
DEFAULT_BUFFER_THRESHOLD
public static final int DEFAULT_BUFFER_THRESHOLD
Default threshold size for buffer.- See Also:
- Constant Field Values
-
MULTI_PART_CONFIG_RESOURCE
public static final java.lang.String 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.- See Also:
- Constant Field Values
-
BUFFER_THRESHOLD
public static final java.lang.String 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 is 4096.- See Also:
- Constant Field Values
-
BUFFER_THRESHOLD_MEMORY_ONLY
public static final int BUFFER_THRESHOLD_MEMORY_ONLY
TheBUFFER_THRESHOLD
property value to keep a body part entity in memory only.- See Also:
- Constant Field Values
-
TEMP_DIRECTORY
public static final java.lang.String 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:
- Constant Field Values
-
bufferThreshold
private int bufferThreshold
The threshold size (in bytes) above which a body part entity will be buffered to disk instead of being held in memory.
-
tempDir
private java.lang.String tempDir
Directory to store temporary files containing body parts of multipart message that extends allowed memory threshold.
-
-
Method Detail
-
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
public java.lang.String 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
-
bufferThreshold
public MultiPartProperties bufferThreshold(int threshold)
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
public MultiPartProperties tempDir(java.lang.String path)
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
-
configure
private void configure()
Configure the values returned by this instance's getters based on the contents of a properties resource, if it exists on the classpath for this application.- Throws:
java.lang.IllegalArgumentException
- if the configuration resource exists, but there are problems reading it
-
resolver
public javax.ws.rs.ext.ContextResolver<MultiPartProperties> resolver()
Create acontext resolver
for a current state of thisMultiPartProperties
.- Returns:
- context resolver for this config.
- Since:
- 2.4.1
-
-