|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry.multipart.DefaultMultipartDecoder
public class DefaultMultipartDecoder
Decodes the data in a multipart/form-data
HTTP request, handling
file uploads and multi-valued parameters. After decoding, the class is used
to access the parameter values.
This implementation is a thin wrapper around the Apache Jakarta FileUpload.
Supports single valued parameters, multi-valued parameters and individual
file uploads. That is, for file uploads, each upload must be a unique parameter
(that is all the Upload
component needs).
Field Summary | |
---|---|
static String |
PART_MAP_ATTRIBUTE_NAME
Request attribute key used to store the part map for this request. |
Constructor Summary | |
---|---|
DefaultMultipartDecoder()
|
Method Summary | |
---|---|
void |
cleanup(HttpServletRequest request)
Invokes IPart.cleanup() on each part. |
void |
decode(HttpServletRequest request)
Decodes the request, storing the part map (keyed on query parameter name, value is IPart into the request as an attribute. |
int |
getMaxSize()
|
String |
getRepositoryPath()
|
static DefaultMultipartDecoder |
getSharedInstance()
|
String |
getString(HttpServletRequest request,
String name)
Returns the single value (or first value) for the parameter with the specified name. |
String[] |
getStrings(HttpServletRequest request,
String name)
Returns an array of values (possibly a single element array). |
int |
getThresholdSize()
|
IUploadFile |
getUploadFile(HttpServletRequest request,
String name)
Returns the uploaded file with the specified parameter name, or null if no such parameter was in the request. |
static boolean |
isMultipartRequest(HttpServletRequest request)
|
void |
setMaxSize(int maxSize)
|
void |
setRepositoryPath(String repositoryPath)
|
void |
setThresholdSize(int thresholdSize)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PART_MAP_ATTRIBUTE_NAME
decode(HttpServletRequest)
. By storing
the part map in the request instead of an instance variable, DefaultMultipartDecoder
becomes threadsafe (no client-specific state in instance variables).
Constructor Detail |
---|
public DefaultMultipartDecoder()
Method Detail |
---|
public static DefaultMultipartDecoder getSharedInstance()
public void setMaxSize(int maxSize)
public int getMaxSize()
public void setThresholdSize(int thresholdSize)
public int getThresholdSize()
public void setRepositoryPath(String repositoryPath)
public String getRepositoryPath()
public static boolean isMultipartRequest(HttpServletRequest request)
public void cleanup(HttpServletRequest request)
IPart.cleanup()
on each part.
cleanup
in interface IMultipartDecoder
public void decode(HttpServletRequest request)
IPart
into the request as an attribute.
decode
in interface IMultipartDecoder
ApplicationRuntimeException
- if decode fails, for instance the
request exceeds getMaxSize()public String getString(HttpServletRequest request, String name)
IMultipartDecoder
getString
in interface IMultipartDecoder
public String[] getStrings(HttpServletRequest request, String name)
IMultipartDecoder
getStrings
in interface IMultipartDecoder
public IUploadFile getUploadFile(HttpServletRequest request, String name)
IMultipartDecoder
getUploadFile
in interface IMultipartDecoder
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |