public static class Http.Context
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Http.Context.Implicit
Import in templates to get implicit HTTP context.
|
Modifier and Type | Field and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
args
Free space to store your request specific data
|
static java.lang.ThreadLocal<Http.Context> |
current |
Constructor and Description |
---|
Context(Http.Request request)
Creates a new HTTP context.
|
Context(Http.RequestBuilder requestBuilder)
Creates a new HTTP context.
|
Context(java.lang.Long id,
play.api.mvc.RequestHeader header,
Http.Request request,
java.util.Map<java.lang.String,java.lang.String> sessionData,
java.util.Map<java.lang.String,java.lang.String> flashData,
java.util.Map<java.lang.String,java.lang.Object> args)
Creates a new HTTP context.
|
Modifier and Type | Method and Description |
---|---|
play.api.mvc.RequestHeader |
_requestHeader()
The original Play request Header used to create this context.
|
boolean |
changeLang(Lang lang)
Change durably the lang for the current user.
|
boolean |
changeLang(java.lang.String code)
Change durably the lang for the current user.
|
void |
clearLang()
Clear the lang for the current user.
|
static Http.Context |
current()
Retrieves the current HTTP context, for the current thread.
|
Http.Flash |
flash()
Returns the current flash scope.
|
java.lang.Long |
id()
The context id (unique)
|
Lang |
lang() |
Messages |
messages() |
Http.Request |
request()
Returns the current request.
|
Http.Response |
response()
Returns the current response.
|
Http.Session |
session()
Returns the current session.
|
java.lang.String |
toString() |
public static java.lang.ThreadLocal<Http.Context> current
public java.util.Map<java.lang.String,java.lang.Object> args
public Context(Http.RequestBuilder requestBuilder)
requestBuilder
- the HTTP request builderpublic Context(Http.Request request)
request
- the HTTP requestpublic Context(java.lang.Long id, play.api.mvc.RequestHeader header, Http.Request request, java.util.Map<java.lang.String,java.lang.String> sessionData, java.util.Map<java.lang.String,java.lang.String> flashData, java.util.Map<java.lang.String,java.lang.Object> args)
request
- the HTTP requestsessionData
- the session data extracted from the session cookieflashData
- the flash data extracted from the flash cookiepublic static Http.Context current()
public java.lang.Long id()
public Http.Request request()
public Http.Response response()
public Http.Session session()
public Http.Flash flash()
public play.api.mvc.RequestHeader _requestHeader()
public Lang lang()
public Messages messages()
public boolean changeLang(java.lang.String code)
code
- New lang code to use (e.g. "fr", "en-US", etc.)public boolean changeLang(Lang lang)
lang
- New Lang object to use.public void clearLang()
public java.lang.String toString()
toString
in class java.lang.Object