public interface Request extends RequestContainer
RequestContainer
and allows processing a HttpServletRequest
by
calling process(HttpServletRequest)
.Modifier and Type | Field and Description |
---|---|
static String |
REQUEST_PARSED
request-attribute to store a parsed
HttpServletRequest in |
Modifier and Type | Method and Description |
---|---|
void |
addParameter(String key,
String value)
Adds the given parameter to this
Request , but only if such a parameter not already exists. |
void |
addParameters(Map<String,String> parameters)
Adds the given parameters to this
Request , but only for those parameters not already existsing. |
List<String> |
getAcceptedTypes(String uploadName)
Returns the accepted file-extensions/content-types for the input field with the given name.
|
String |
getEncoding()
Return the encoding for this request
|
javax.servlet.http.HttpServletRequest |
getHttpServletRequest()
Returns the previously processed
HttpServletRequest |
boolean |
isGet()
Returns
true if this is a HTPP GET request. |
boolean |
isMultiPart()
Returns
true if this is a multipart request. |
boolean |
isPost()
Returns
true if this is a HTPP POST request. |
boolean |
isValid()
Checks whether this is a valid
Request , i.e. |
void |
process(javax.servlet.http.HttpServletRequest httpServletRequest)
Processes the given
HttpServletRequest . |
void |
setAcceptedTypes(String uploadName,
String... types)
Sets the accepted mime-types or filetype-extensions for the given field
|
void |
setEncoding(String encoding)
Sets the encoding for this request
|
void |
setMaxSize(long maxSize)
Sets the maximum size for a
FormUpload within this Request . |
void |
setMaxSize(long maxSize,
boolean strict)
Sets the maximum size for a
FormUpload within this Request , and additionally defines if
violations should be handled strict. |
void |
setTempDir(File tempDir)
Sets the (absolute) temporary directory for storing
FormUpload s. |
getFormUploads, getFormUploads, getHost, getParameter, getParameterList, getParameterNames, getParameters, getParametersList, hasParameter
static final String REQUEST_PARSED
HttpServletRequest
invoid process(javax.servlet.http.HttpServletRequest httpServletRequest)
HttpServletRequest
. Must only be called once per HttpServletRequest
.httpServletRequest
- the HttpServletRequest
to processjavax.servlet.http.HttpServletRequest getHttpServletRequest()
HttpServletRequest
HttpServletRequest
String getEncoding()
void setEncoding(String encoding)
encoding
- the encodingboolean isMultiPart()
true
if this is a multipart request.true
if this is a multipart request, false
otherwiseboolean isPost()
true
if this is a HTPP POST request.true
if this is a HTPP POST request, false
otherwiseboolean isGet()
true
if this is a HTPP GET request.true
if this is a HTPP GET request, false
otherwiseboolean isValid()
Request
, i.e. no Exception
occurred during
process(HttpServletRequest)
.true
if this Request
is valid, false
otherwisevoid setTempDir(File tempDir)
FormUpload
s. Note that, if not set or not existent,
the directory specified by the System
propertey java.io.tmpdir
is used.tempDir
- the directory for storing FormUpload
svoid setMaxSize(long maxSize)
FormUpload
within this Request
.maxSize
- the maximum size of a FormUpload
FormUpload.getMaxSize()
void setMaxSize(long maxSize, boolean strict)
FormUpload
within this Request
, and additionally defines if
violations should be handled strict.maxSize
- the maximum size of a FormUpload
strict
- if set to true
, and a FormUpload
exceeds the given size, the whole Request
will be marked as invalid.isValid()
void setAcceptedTypes(String uploadName, String... types)
uploadName
- the name of the input-field (type="file")types
- the accepted mimetypes (e.g. image/jpeg, image/png) or file extensions (e.g jgp,png), those can be
used in combinationList<String> getAcceptedTypes(String uploadName)
uploadName
- the name of the input fieldFormUpload.getAcceptedTypes()
void addParameters(Map<String,String> parameters)
Request
, but only for those parameters not already existsing. This
prevents overwriting a parameter which is already present in the original HttpServletRequest
. The given
Map
uses the parameter name as the key and the parameter value as the value.parameters
- the parameters to addaddParameter(String, String)
,
RequestContainer.getParameter(String)
void addParameter(String key, String value)
Request
, but only if such a parameter not already exists. This prevents
overwriting a parameter which is already present in the original HttpServletRequest
.key
- the parameter namevalue
- the parameter valueCopyright © 2011–2020 aiticon GmbH. All rights reserved.