Package play.mvc
Class Http.Request
- java.lang.Object
-
- play.mvc.Http.Request
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- Http
public static class Http.Request extends java.lang.Object implements java.io.SerializableAn HTTP Request- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringactionFull action (ex: Application.index)java.lang.StringactionMethodAction method namejava.util.Map<java.lang.String,java.lang.Object>argsFree space to store your request specific datajava.io.InputStreambodyBody streamjava.lang.StringcontentTypeRequest content-typejava.lang.StringcontrollerController to invokejava.lang.Class<? extends PlayController>controllerClassThe invoked controller classPlayControllercontrollerInstanceThe instance of invoked controller in case it uses non-static action methods.java.util.Map<java.lang.String,Http.Cookie>cookiesHTTP Cookiesstatic java.lang.ThreadLocal<Http.Request>currentBind to threadjava.util.DatedateWhen the request has been receivedjava.lang.StringdomainServer domainjava.lang.StringencodingThis is the encoding used to decode this request.java.lang.StringformatFormat (html,xml,json,text)java.util.Map<java.lang.String,Http.Header>headersHTTP Headersjava.lang.StringhostServer hostjava.lang.reflect.MethodinvokedMethodThe really invoker Java methodbooleanisLoopbackRequest comes from loopback interfacebooleanisNewNew request or already submittedjava.lang.StringmethodHTTP methodScope.ParamsparamsParamsjava.lang.StringpasswordHTTP Basic Passwordjava.lang.StringpathRequest pathjava.lang.IntegerportHTTP portjava.lang.StringquerystringQueryStringjava.lang.StringremoteAddressClient addressjava.util.Map<java.lang.String,java.lang.String>routeArgsAdditional HTTP params extracted from routejava.lang.Booleansecureis HTTPS ?java.lang.StringurlURL path (excluding scheme, host and port), starting with '/'
Example:
With this full URLhttp://localhost:9000/path0/path1
=> url will be/path0/path1java.lang.StringuserHTTP Basic User
-
Constructor Summary
Constructors Constructor Description Request()Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void_init()Deprecated.java.util.List<java.lang.String>acceptLanguage()Return the languages requested by the browser, ordered by preference (preferred first).protected voidauthorizationInit()static Http.RequestcreateRequest(java.lang.String _remoteAddress, java.lang.String _method, java.lang.String _path, java.lang.String _querystring, java.lang.String _contentType, java.io.InputStream _body, java.lang.String _url, java.lang.String _host, boolean _isLoopback, int _port, java.lang.String _domain, boolean _secure, java.util.Map<java.lang.String,Http.Header> _headers, java.util.Map<java.lang.String,Http.Cookie> _cookies)All creation / initiating of new requests should use this method.static Http.Requestcurrent()Retrieve the current requestHttp.Requestget()Useful because we sometime use a lazy request loaderjava.lang.StringgetBase()Get the request base (ex: http://localhost:9000booleanisAjax()This request was sent by an Ajax framework.booleanisModified(java.lang.String etag, long last)protected voidparseXForwarded()voidresolveFormat()Automatically resolve request format from the Accept header (in this order : html > xml > json > text)java.lang.StringtoString()
-
-
-
Field Detail
-
host
public java.lang.String host
Server host
-
path
public java.lang.String path
Request path
-
querystring
public java.lang.String querystring
QueryString
-
url
public java.lang.String url
URL path (excluding scheme, host and port), starting with '/'
Example:
With this full URLhttp://localhost:9000/path0/path1
=> url will be/path0/path1
-
method
public java.lang.String method
HTTP method
-
domain
public java.lang.String domain
Server domain
-
remoteAddress
public java.lang.String remoteAddress
Client address
-
contentType
public java.lang.String contentType
Request content-type
-
encoding
public java.lang.String encoding
This is the encoding used to decode this request. If encoding-info is not found in request, then Play.defaultWebEncoding is used
-
controller
public java.lang.String controller
Controller to invoke
-
actionMethod
public java.lang.String actionMethod
Action method name
-
port
public java.lang.Integer port
HTTP port
-
secure
public java.lang.Boolean secure
is HTTPS ?
-
headers
public java.util.Map<java.lang.String,Http.Header> headers
HTTP Headers
-
cookies
public java.util.Map<java.lang.String,Http.Cookie> cookies
HTTP Cookies
-
body
public transient java.io.InputStream body
Body stream
-
routeArgs
public java.util.Map<java.lang.String,java.lang.String> routeArgs
Additional HTTP params extracted from route
-
format
public java.lang.String format
Format (html,xml,json,text)
-
action
public java.lang.String action
Full action (ex: Application.index)
-
current
public static final java.lang.ThreadLocal<Http.Request> current
Bind to thread
-
invokedMethod
public transient java.lang.reflect.Method invokedMethod
The really invoker Java method
-
controllerClass
public transient java.lang.Class<? extends PlayController> controllerClass
The invoked controller class
-
controllerInstance
public transient PlayController controllerInstance
The instance of invoked controller in case it uses non-static action methods.
-
args
public java.util.Map<java.lang.String,java.lang.Object> args
Free space to store your request specific data
-
date
public java.util.Date date
When the request has been received
-
isNew
public boolean isNew
New request or already submitted
-
user
public java.lang.String user
HTTP Basic User
-
password
public java.lang.String password
HTTP Basic Password
-
isLoopback
public boolean isLoopback
Request comes from loopback interface
-
params
public final Scope.Params params
Params
-
-
Method Detail
-
createRequest
public static Http.Request createRequest(java.lang.String _remoteAddress, java.lang.String _method, java.lang.String _path, java.lang.String _querystring, java.lang.String _contentType, java.io.InputStream _body, java.lang.String _url, java.lang.String _host, boolean _isLoopback, int _port, java.lang.String _domain, boolean _secure, java.util.Map<java.lang.String,Http.Header> _headers, java.util.Map<java.lang.String,Http.Cookie> _cookies)
All creation / initiating of new requests should use this method. The purpose of this is to "show" what is needed when creating new Requests.- Parameters:
_remoteAddress- The remote IP address_method- the Method_path- path_querystring- The query String_contentType- The content Type_body- The request body_url- The request URL_host- The request host_isLoopback- Indicate if the request comes from loopback interface_port- The request port_domain- The request domain_secure- Indicate is request is secure or not_headers- The request headers_cookies- The request cookies- Returns:
- the newly created Request object
-
parseXForwarded
protected void parseXForwarded()
-
_init
@Deprecated public void _init()
Deprecated.Deprecated to encourage users to use createRequest() instead.
-
authorizationInit
protected void authorizationInit()
-
resolveFormat
public void resolveFormat()
Automatically resolve request format from the Accept header (in this order : html > xml > json > text)
-
current
public static Http.Request current()
Retrieve the current request- Returns:
- the current request
-
get
public Http.Request get()
Useful because we sometime use a lazy request loader- Returns:
- itself
-
isAjax
public boolean isAjax()
This request was sent by an Ajax framework. (rely on the X-Requested-With header).- Returns:
- True is the request is an Ajax, false otherwise
-
getBase
public java.lang.String getBase()
Get the request base (ex: http://localhost:9000- Returns:
- the request base of the url (protocol, host and port)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
acceptLanguage
public java.util.List<java.lang.String> acceptLanguage()
Return the languages requested by the browser, ordered by preference (preferred first). If no Accept-Language header is present, an empty list is returned.- Returns:
- Language codes in order of preference, e.g. "en-us,en-gb,en,de".
-
isModified
public boolean isModified(java.lang.String etag, long last)
-
-