Package org.appng.forms
Interface Request
-
- All Superinterfaces:
RequestContainer
- All Known Implementing Classes:
RequestBean
public interface Request extends RequestContainer
Extends the informations provided by aRequestContainer
and allows processing aHttpServletRequest
by callingprocess(HttpServletRequest)
.- Author:
- Matthias Müller
-
-
Field Summary
Fields Modifier and Type Field Description static String
REQUEST_PARSED
request-attribute to store a parsedHttpServletRequest
in
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addParameter(String key, String value)
Adds the given parameter to thisRequest
, but only if such a parameter not already exists.void
addParameters(Map<String,String> parameters)
Adds the given parameters to thisRequest
, 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 requestjavax.servlet.http.HttpServletRequest
getHttpServletRequest()
Returns the previously processedHttpServletRequest
boolean
isGet()
Returnstrue
if this is a HTPP GET request.boolean
isMultiPart()
Returnstrue
if this is a multipart request.boolean
isPost()
Returnstrue
if this is a HTPP POST request.boolean
isValid()
Checks whether this is a validRequest
, i.e.void
process(javax.servlet.http.HttpServletRequest httpServletRequest)
Processes the givenHttpServletRequest
.void
setAcceptedTypes(String uploadName, String... types)
Sets the accepted mime-types or filetype-extensions for the given fieldvoid
setEncoding(String encoding)
Sets the encoding for this requestvoid
setMaxSize(long maxSize)
Sets the maximum size for aFormUpload
within thisRequest
.void
setMaxSize(long maxSize, boolean strict)
Sets the maximum size for aFormUpload
within thisRequest
, and additionally defines if violations should be handled strict.void
setTempDir(File tempDir)
Sets the (absolute) temporary directory for storingFormUpload
s.-
Methods inherited from interface org.appng.forms.RequestContainer
getFormUploads, getFormUploads, getHost, getParameter, getParameterList, getParameterNames, getParameters, getParametersList, hasParameter
-
-
-
-
Field Detail
-
REQUEST_PARSED
static final String REQUEST_PARSED
request-attribute to store a parsedHttpServletRequest
in
-
-
Method Detail
-
process
void process(javax.servlet.http.HttpServletRequest httpServletRequest)
Processes the givenHttpServletRequest
. Must only be called once perHttpServletRequest
.- Parameters:
httpServletRequest
- theHttpServletRequest
to process
-
getHttpServletRequest
javax.servlet.http.HttpServletRequest getHttpServletRequest()
Returns the previously processedHttpServletRequest
- Returns:
- the
HttpServletRequest
-
getEncoding
String getEncoding()
Return the encoding for this request- Returns:
- the encoding
-
setEncoding
void setEncoding(String encoding)
Sets the encoding for this request- Parameters:
encoding
- the encoding
-
isMultiPart
boolean isMultiPart()
Returnstrue
if this is a multipart request.- Returns:
true
if this is a multipart request,false
otherwise
-
isPost
boolean isPost()
Returnstrue
if this is a HTPP POST request.- Returns:
true
if this is a HTPP POST request,false
otherwise
-
isGet
boolean isGet()
Returnstrue
if this is a HTPP GET request.- Returns:
true
if this is a HTPP GET request,false
otherwise
-
isValid
boolean isValid()
Checks whether this is a validRequest
, i.e. noException
occurred duringprocess(HttpServletRequest)
.- Returns:
true
if thisRequest
is valid,false
otherwise
-
setTempDir
void setTempDir(File tempDir)
Sets the (absolute) temporary directory for storingFormUpload
s. Note that, if not set or not existent, the directory specified by theSystem
properteyjava.io.tmpdir
is used.- Parameters:
tempDir
- the directory for storingFormUpload
s
-
setMaxSize
void setMaxSize(long maxSize)
Sets the maximum size for aFormUpload
within thisRequest
.- Parameters:
maxSize
- the maximum size of aFormUpload
- See Also:
FormUpload.getMaxSize()
-
setMaxSize
void setMaxSize(long maxSize, boolean strict)
Sets the maximum size for aFormUpload
within thisRequest
, and additionally defines if violations should be handled strict.- Parameters:
maxSize
- the maximum size of aFormUpload
strict
- if set totrue
, and aFormUpload
exceeds the given size, the wholeRequest
will be marked as invalid.- See Also:
isValid()
-
setAcceptedTypes
void setAcceptedTypes(String uploadName, String... types)
Sets the accepted mime-types or filetype-extensions for the given field- Parameters:
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 combination
-
getAcceptedTypes
List<String> getAcceptedTypes(String uploadName)
Returns the accepted file-extensions/content-types for the input field with the given name.- Parameters:
uploadName
- the name of the input field- Returns:
- a list of accepted tyes
- See Also:
FormUpload.getAcceptedTypes()
-
addParameters
void addParameters(Map<String,String> parameters)
Adds the given parameters to thisRequest
, but only for those parameters not already existsing. This prevents overwriting a parameter which is already present in the originalHttpServletRequest
. The givenMap
uses the parameter name as the key and the parameter value as the value.- Parameters:
parameters
- the parameters to add- See Also:
addParameter(String, String)
,RequestContainer.getParameter(String)
-
addParameter
void addParameter(String key, String value)
Adds the given parameter to thisRequest
, but only if such a parameter not already exists. This prevents overwriting a parameter which is already present in the originalHttpServletRequest
.- Parameters:
key
- the parameter namevalue
- the parameter value
-
-