public interface HTTPRequest
Modifier and Type | Method and Description |
---|---|
void |
freeParts()
Free all the parts.
|
int |
getContentLength()
Get the length of the original uploaded raw data for a POST.
|
java.lang.String |
getHeader(java.lang.String name)
Get the value of a specific header on the request.
|
int |
getIntParam(java.lang.String name)
Get the value of a request parameter converted to an int, using 0 as
default value.
|
int |
getIntParam(java.lang.String name,
int defaultValue)
Get the value of a request parameter converted to an
int ,
using the specified default value. |
int |
getIntPart(java.lang.String name,
int defaultValue)
Get a part as an integer with a default value if it is not set.
|
long |
getLongParam(java.lang.String name,
long defaultValue)
Get a part as a long, with a default value if it is not set.
|
java.lang.String |
getMethod()
Get the HTTP method, typically GET or POST.
|
int[] |
getMultipleIntParam(java.lang.String name)
Get all values of a request parameter as int array, ignoring all values
that can not be parsed.
|
java.lang.String[] |
getMultipleParam(java.lang.String name)
Get all values of a request parameter as a string array.
|
java.lang.String |
getParam(java.lang.String name)
Get the value of a request parameter, using an empty string as default
value if the parameter was not set.
|
java.lang.String |
getParam(java.lang.String name,
java.lang.String defaultValue)
Get the value of a request parameter, using the specified default value
if the parameter was not set or has an empty value.
|
java.util.Collection<java.lang.String> |
getParameterNames()
Returns the names of all parameters.
|
RandomAccessBucket |
getPart(java.lang.String name)
Get a part as a Bucket.
|
byte[] |
getPartAsBytes(java.lang.String name,
int maxlength)
Deprecated.
|
byte[] |
getPartAsBytesFailsafe(java.lang.String name,
int maxlength)
Gets up to maxLength bytes from the part, ignores any bytes after the limit.
|
byte[] |
getPartAsBytesThrowing(java.lang.String name,
int maxlength) |
java.lang.String |
getPartAsString(java.lang.String name,
int maxlength)
Deprecated.
|
java.lang.String |
getPartAsStringFailsafe(java.lang.String name,
int maxlength)
Gets up to maxLength characters from the part, ignores any characters after the limit.
|
java.lang.String |
getPartAsStringThrowing(java.lang.String name,
int maxlength) |
java.lang.String[] |
getParts() |
java.lang.String |
getPath()
The path of this request, where the part of the path the specified the
plugin has already been removed..
|
Bucket |
getRawData()
Get the original uploaded raw data for a POST.
|
HTTPUploadedFile |
getUploadedFile(java.lang.String name)
Get a file uploaded in the HTTP request.
|
boolean |
hasParameters() |
boolean |
isChrome()
Is the browser Chrome according to User-Agent?
|
boolean |
isIncognito()
Is the incognito=true boolean set? Sadly this does not prove that
it is actually running incognito mode...
|
boolean |
isParameterSet(java.lang.String name)
Check if a parameter was set in the request at all, either with or
without a value.
|
boolean |
isPartSet(java.lang.String name)
Is a part set with the given name?
|
java.lang.String getPath()
boolean hasParameters()
boolean isParameterSet(java.lang.String name)
name
- the name of the parameter to checkjava.lang.String getParam(java.lang.String name)
if (request.getParam("abc").equals("def"))
name
- the name of the parameter to getjava.lang.String getParam(java.lang.String name, java.lang.String defaultValue)
name
- the name of the parameter to getdefaultValue
- the default value to be returned if the parameter is missing
or emptyint getIntParam(java.lang.String name)
name
- the name of the parameter to getint getIntParam(java.lang.String name, int defaultValue)
int
,
using the specified default value. If there are multiple values for this
parameter, the first value is used.name
- the name of the parameter to getdefaultValue
- the default value to be returned if the parameter is missing,
empty or invalidint getIntPart(java.lang.String name, int defaultValue)
java.lang.String[] getMultipleParam(java.lang.String name)
null
.name
- the name of the parameter to getint[] getMultipleIntParam(java.lang.String name)
null
.name
- the name of the parameter to getHTTPUploadedFile getUploadedFile(java.lang.String name)
RandomAccessBucket getPart(java.lang.String name)
boolean isPartSet(java.lang.String name)
@Deprecated java.lang.String getPartAsString(java.lang.String name, int maxlength)
java.lang.String getPartAsStringThrowing(java.lang.String name, int maxlength) throws java.util.NoSuchElementException, javax.naming.SizeLimitExceededException
java.util.NoSuchElementException
javax.naming.SizeLimitExceededException
java.lang.String getPartAsStringFailsafe(java.lang.String name, int maxlength)
@Deprecated byte[] getPartAsBytes(java.lang.String name, int maxlength)
byte[] getPartAsBytesThrowing(java.lang.String name, int maxlength) throws java.util.NoSuchElementException, javax.naming.SizeLimitExceededException
java.util.NoSuchElementException
javax.naming.SizeLimitExceededException
byte[] getPartAsBytesFailsafe(java.lang.String name, int maxlength)
void freeParts()
long getLongParam(java.lang.String name, long defaultValue)
java.lang.String getMethod()
Bucket getRawData()
java.lang.String getHeader(java.lang.String name)
int getContentLength()
java.lang.String[] getParts()
java.util.Collection<java.lang.String> getParameterNames()
boolean isIncognito()
boolean isChrome()