public class FakeRequest
extends org.wisdom.api.http.Request
| Modifier and Type | Field and Description |
|---|---|
private FakeContext |
context |
private Map<String,Object> |
data |
| Constructor and Description |
|---|
FakeRequest(FakeContext fakeContext)
Creates an instance of fake request.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accepts(String mimeType)
Checks if this request accepts a given media type.
|
String |
charset()
Get the charset that is acceptable for the client.
|
String |
contentType()
The Content-Type header field indicates the media type of the request
body sent to the recipient.
|
org.wisdom.api.cookies.Cookies |
cookies() |
Map<String,Object> |
data()
Retrieves the data shared by all the entities participating to the request resolution (i.e.
|
String |
encoding()
Get the encoding that is acceptable for the client.
|
Map<String,List<String>> |
headers()
Retrieves all headers.
|
String |
host() |
String |
language()
Get the language that is acceptable for the client.
|
com.google.common.net.MediaType |
mediaType() |
Collection<com.google.common.net.MediaType> |
mediaTypes() |
String |
method()
Returns the name of the HTTP method with which this
request was made, for example, GET, POST, or PUT.
|
String |
parameter(String name)
Get the parameter with the given key from the request.
|
String |
parameter(String name,
String defaultValue)
Same like
parameter(String), but returns given defaultValue
instead of null in case parameter cannot be found. |
Boolean |
parameterAsBoolean(String name)
Same like
parameter(String), but converts the parameter to
Boolean if found. |
Boolean |
parameterAsBoolean(String name,
boolean defaultValue)
Same like
parameter(String), but converts the parameter to
Boolean if found. |
Integer |
parameterAsInteger(String name)
Same like
parameter(String), but converts the parameter to
Integer if found. |
Integer |
parameterAsInteger(String name,
Integer defaultValue)
Same like
parameter(String, String), but converts the
parameter to Integer if found. |
List<String> |
parameterMultipleValues(String name)
Get the parameter with the given key from the request.
|
Map<String,List<String>> |
parameters()
Get all the parameters from the request.
|
String |
path() |
String |
remoteAddress()
The client IP address.
|
String |
uri() |
private final FakeContext context
public FakeRequest(FakeContext fakeContext)
fakeContext - the contextpublic String contentType()
Content-Type: text/html;
charset=ISO-8859-4contentType in class org.wisdom.api.http.Requestpublic String method()
method in class org.wisdom.api.http.Requestpublic String parameter(String name)
When the parameter is multivalued, returns the first value.
The parameter is decoded by default.
parameter in class org.wisdom.api.http.Requestname - The key of the parameterparameterMultipleValues(java.lang.String)public List<String> parameterMultipleValues(String name)
The parameter is decoded by default.
parameterMultipleValues in class org.wisdom.api.http.Requestname - The key of the parameterpublic String parameter(String name, String defaultValue)
parameter(String), but returns given defaultValue
instead of null in case parameter cannot be found.
The parameter is decoded by default.
parameter in class org.wisdom.api.http.Requestname - The name of the post or query parameterdefaultValue - A default value if parameter not found.public Integer parameterAsInteger(String name)
parameter(String), but converts the parameter to
Integer if found.
The parameter is decoded by default.
parameterAsInteger in class org.wisdom.api.http.Requestname - The name of the post or query parameterpublic Integer parameterAsInteger(String name, Integer defaultValue)
parameter(String, String), but converts the
parameter to Integer if found.
The parameter is decoded by default.
parameterAsInteger in class org.wisdom.api.http.Requestname - The name of the post or query parameterdefaultValue - A default value if parameter not found.public Boolean parameterAsBoolean(String name)
parameter(String), but converts the parameter to
Boolean if found.
The parameter is decoded by default.
parameterAsBoolean in class org.wisdom.api.http.Requestname - The name of the post or query parameterpublic Boolean parameterAsBoolean(String name, boolean defaultValue)
parameter(String), but converts the parameter to
Boolean if found.
The parameter is decoded by default.
parameterAsBoolean in class org.wisdom.api.http.Requestname - The name of the post or query parameterdefaultValue - A default value if parameter not found.public Map<String,List<String>> parameters()
parameters in class org.wisdom.api.http.Requestpublic Map<String,Object> data()
data in class org.wisdom.api.http.Requestpublic String uri()
uri in class org.wisdom.api.http.RequestHeaderpublic String remoteAddress()
remoteAddress in class org.wisdom.api.http.RequestHeaderpublic String host()
host in class org.wisdom.api.http.RequestHeaderpublic String path()
path in class org.wisdom.api.http.RequestHeaderpublic com.google.common.net.MediaType mediaType()
mediaType in class org.wisdom.api.http.RequestHeaderpublic Collection<com.google.common.net.MediaType> mediaTypes()
mediaTypes in class org.wisdom.api.http.RequestHeaderpublic boolean accepts(String mimeType)
accepts in class org.wisdom.api.http.RequestHeadermimeType - the mime type to check.public org.wisdom.api.cookies.Cookies cookies()
cookies in class org.wisdom.api.http.RequestHeaderpublic Map<String,List<String>> headers()
headers in class org.wisdom.api.http.RequestHeaderpublic String encoding()
The Accept-Encoding request-header field is similar to Accept, but restricts the content-codings that are acceptable in the response.
encoding in class org.wisdom.api.http.RequestHeaderpublic String language()
The Accept-Language request-header field is similar to Accept, but restricts the set of natural languages that are preferred as a response to the request.
language in class org.wisdom.api.http.RequestHeaderpublic String charset()
The Accept-Charset request-header field can be used to indicate what character sets are acceptable for the response. This field allows clients capable of understanding more comprehensive or special- purpose character sets to signal that capability to a server which is capable of representing documents in those character sets.
charset in class org.wisdom.api.http.RequestHeaderCopyright © 2013–2014 Wisdom Framework. All rights reserved.