|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object play.mvc.Controller
public abstract class Controller
Application controller support
Field Summary | |
---|---|
static java.lang.ThreadLocal<Router.ActionDefinition> |
_currentReverse
Don't use this directly if you don't know why |
protected static Scope.Flash |
flash
The current flash scope |
protected static Scope.Params |
params
The current HTTP params |
protected static Scope.RenderArgs |
renderArgs
The current renderArgs (used in templates) |
protected static Http.Request |
request
The current HTTP request |
protected static Http.Response |
response
The current HTTP response |
protected static Scope.Session |
session
The current HTTP session |
protected static Validation |
validation
The current Validation |
Constructor Summary | |
---|---|
Controller()
|
Method Summary | ||
---|---|---|
protected static void |
error()
Send a 500 Error response |
|
protected static void |
error(int status,
java.lang.String reason)
Send a 5xx Error response |
|
protected static void |
error(java.lang.String reason)
Send a 500 Error response |
|
protected static void |
flash(java.lang.String key,
java.lang.Object value)
Add a value to the flash scope |
|
protected static void |
forbidden()
Send a 403 Forbidden response |
|
protected static void |
forbidden(java.lang.String reason)
Send a 403 Forbidden response |
|
protected static
|
getActionAnnotation(java.lang.Class<T> clazz)
Retrieve annotation for the action method |
|
protected static
|
getControllerAnnotation(java.lang.Class<T> clazz)
Retrieve annotation for the controller class |
|
protected static java.lang.Class |
getControllerClass()
Retrieve annotation for the action method |
|
protected static
|
getControllerInheritedAnnotation(java.lang.Class<T> clazz)
Retrieve annotation for the controller class |
|
protected static void |
notFound()
Send a 404 Not Found reponse |
|
protected static void |
notFound(java.lang.String what)
Send a 404 Not Found response |
|
protected static void |
notFoundIfNull(java.lang.Object o)
Send a 404 Not Found response if object is null |
|
protected static void |
notModified()
Send a 304 Not Modified response |
|
protected static void |
ok()
Send a 200 OK response |
|
protected static void |
parent()
Call the parent method |
|
protected static void |
parent(java.util.Map<java.lang.String,java.lang.Object> map)
Call the parent action adding this objects to the params scope |
|
protected static void |
parent(java.lang.Object... args)
Call the parent action adding this objects to the params scope |
|
protected static void |
redirect(java.lang.String url)
Send a 302 redirect response. |
|
protected static void |
redirect(java.lang.String url,
boolean permanent)
Send a Redirect response. |
|
protected static void |
redirect(java.lang.String action,
boolean permanent,
java.lang.Object... args)
Redirect to another action |
|
protected static void |
redirect(java.lang.String action,
java.lang.Object... args)
302 Redirect to another action |
|
protected static void |
redirectToStatic(java.lang.String file)
Send a 302 redirect response. |
|
protected static void |
render(java.lang.Object... args)
Render the corresponding template |
|
protected static void |
renderBinary(java.io.File file)
Return a 200 OK application/binary response |
|
protected static void |
renderBinary(java.io.File file,
java.lang.String name)
Return a 200 OK application/binary response with content-disposition attachment |
|
protected static void |
renderBinary(java.io.InputStream is)
Return a 200 OK application/binary response |
|
protected static void |
renderBinary(java.io.InputStream is,
java.lang.String name)
Return a 200 OK application/binary response with content-disposition attachment |
|
protected static void |
renderJSON(java.lang.Object o)
Render a 200 OK application/json response |
|
protected static void |
renderJSON(java.lang.Object o,
com.google.gson.JsonSerializer... adapters)
Render a 200 OK application/json response |
|
protected static void |
renderJSON(java.lang.String jsonString)
Render a 200 OK application/json response |
|
protected static void |
renderTemplate(java.lang.String templateName,
java.lang.Object... args)
Render a specific template |
|
protected static void |
renderText(java.lang.CharSequence pattern,
java.lang.Object... args)
Return a 200 OK text/plain response |
|
protected static void |
renderText(java.lang.Object text)
Return a 200 OK text/plain response |
|
protected static void |
renderXml(org.w3c.dom.Document xml)
Return a 200 OK text/xml response |
|
protected static void |
renderXml(java.lang.String xml)
Return a 200 OK text/xml response |
|
protected static Router.ActionDefinition |
reverse()
|
|
protected static void |
suspend(java.lang.String timeout)
Suspend the current request for a specified amount of time |
|
protected static void |
unauthorized(java.lang.String realm)
Send a 401 Unauthorized response |
|
protected static void |
waitFor(java.util.concurrent.Future task)
Suspend this request and wait for the task completion |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static Http.Request request
protected static Http.Response response
protected static Scope.Session session
protected static Scope.Flash flash
protected static Scope.Params params
protected static Scope.RenderArgs renderArgs
protected static Validation validation
public static java.lang.ThreadLocal<Router.ActionDefinition> _currentReverse
Constructor Detail |
---|
public Controller()
Method Detail |
---|
protected static void renderText(java.lang.Object text)
text
- The response contentprotected static void renderText(java.lang.CharSequence pattern, java.lang.Object... args)
pattern
- The response content to be formatted (with String.format)args
- Args for String.formatprotected static void renderXml(java.lang.String xml)
xml
- The XML stringprotected static void renderXml(org.w3c.dom.Document xml)
xml
- The DOM document objectprotected static void renderBinary(java.io.InputStream is)
is
- The stream to copyprotected static void renderBinary(java.io.InputStream is, java.lang.String name)
is
- The stream to copyname
- The attachment nameprotected static void renderBinary(java.io.File file)
file
- The file to copyprotected static void renderBinary(java.io.File file, java.lang.String name)
file
- The file to copyname
- The attachment nameprotected static void renderJSON(java.lang.String jsonString)
jsonString
- The JSON stringprotected static void renderJSON(java.lang.Object o)
o
- The Java object to serializeprotected static void renderJSON(java.lang.Object o, com.google.gson.JsonSerializer... adapters)
o
- The Java object to serializeadapters
- A set of GSON serializers/deserializers/instance creator to useprotected static void notModified()
protected static void unauthorized(java.lang.String realm)
realm
- The realm nameprotected static void notFound(java.lang.String what)
what
- The Not Found resource nameprotected static void ok()
protected static void notFoundIfNull(java.lang.Object o)
o
- The object to checkprotected static void notFound()
protected static void forbidden(java.lang.String reason)
reason
- The reasonprotected static void forbidden()
protected static void error(int status, java.lang.String reason)
status
- The exact status codereason
- The reasonprotected static void error(java.lang.String reason)
reason
- The reasonprotected static void error()
protected static void flash(java.lang.String key, java.lang.Object value)
key
- The keyvalue
- The valueprotected static void redirect(java.lang.String url)
url
- The Location to redirectprotected static void redirectToStatic(java.lang.String file)
file
- The Location to redirectprotected static void redirect(java.lang.String url, boolean permanent)
url
- The Location to redirectpermanent
- true -> 301, false -> 302protected static void redirect(java.lang.String action, java.lang.Object... args)
action
- The fully qualified action name (ex: Application.index)args
- Method argumentsprotected static void redirect(java.lang.String action, boolean permanent, java.lang.Object... args)
action
- The fully qualified action name (ex: Application.index)permanent
- true -> 301, false -> 302args
- Method argumentsprotected static void renderTemplate(java.lang.String templateName, java.lang.Object... args)
templateName
- The template nameargs
- The template dataprotected static void render(java.lang.Object... args)
args
- The template dataprotected static <T extends java.lang.annotation.Annotation> T getActionAnnotation(java.lang.Class<T> clazz)
clazz
- The annotation class
protected static <T extends java.lang.annotation.Annotation> T getControllerAnnotation(java.lang.Class<T> clazz)
clazz
- The annotation class
protected static <T extends java.lang.annotation.Annotation> T getControllerInheritedAnnotation(java.lang.Class<T> clazz)
clazz
- The annotation class
protected static java.lang.Class getControllerClass()
protected static void parent(java.lang.Object... args)
protected static void parent()
protected static void parent(java.util.Map<java.lang.String,java.lang.Object> map)
protected static void suspend(java.lang.String timeout)
protected static void waitFor(java.util.concurrent.Future task)
protected static Router.ActionDefinition reverse()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |