Package play
Class PlayPlugin
java.lang.Object
play.PlayPlugin
- All Implemented Interfaces:
Comparable<PlayPlugin>
- Direct Known Subclasses:
AuthenticityTokenPlugin,DBPlugin,JobsPlugin,JPAPlugin,MessagesPlugin,PlayStatusPlugin,RePlayLogoPlugin,RequestLogPlugin,TempFilePlugin,ValidationPlugin,WS
A framework plugin
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterActionInvocation(Http.Request request, Http.Response response, Scope.Session session, Scope.Flash flash) Called at the end of the action invocation.voidCalled after the application start.voidCalled after an invocation.voidbeforeActionInvocation(Http.Request request, Http.Response response, Scope.Session session, Scope.RenderArgs renderArgs, Scope.Flash flash, Method actionMethod) Called before an 'action' invocation, ie an HTTP request processing.voidCalled before a Play! invocation.bind(Http.Request request, Scope.Session session, RootParamNode rootParamNode, String name, Class<?> clazz, Type type, Annotation[] annotations) Called when play need to bind a Java object from HTTP params.intvoidIt's time for the plugin to detect changes.protected voiddisable()com.google.gson.JsonObjectReturn the plugin status in JSON formatgetMessage(String locale, Object key, Object... args) Translate the given key for the given locale and arguments.Return the plugin statusbooleanloadTemplate(File file) voidonActionInvocationException(Http.Request request, Http.Response response, Throwable e) voidonActionInvocationFinally(Http.Request request, Http.Response response) Called at the end of the action invocation (either in case of success or any failure).voidonActionInvocationResult(Http.Request request, Http.Response response, Scope.Session session, Scope.Flash flash, Scope.RenderArgs renderArgs, Result result) Called when the action method has thrown a result.voidonActionInvocationResult(Http.Request request, Http.Response response, Scope.Session session, Scope.RenderArgs renderArgs, Result result) Deprecated.Use/override method with flash parametervoidCalled at application start (and at each reloading) Time to start stateful things.voidCalled at application stop (and before each reloading) Time to shut down stateful things.voidCalled when the application.conf has been read.voidvoidvoidvoidonLoad()Called at plugin loadingbooleanrawInvocation(Http.Request request, Http.Response response, Scope.Session session, Scope.RenderArgs renderArgs, Scope.Flash flash) Give a chance to this plugin to fully manage this requestvoidrouteRequest(Http.Request request) Let some plugins route themselves
-
Field Details
-
index
public int indexPlugin priority (0 for highest priority)
-
-
Constructor Details
-
PlayPlugin
public PlayPlugin()
-
-
Method Details
-
disable
protected void disable() -
isEnabled
public boolean isEnabled() -
onLoad
public void onLoad()Called at plugin loading -
bind
public Object bind(Http.Request request, Scope.Session session, RootParamNode rootParamNode, String name, Class<?> clazz, Type type, Annotation[] annotations) Called when play need to bind a Java object from HTTP params.- Parameters:
rootParamNode- parameters to bindname- the name of the objectclazz- the class of the object to bindtype- typeannotations- annotation on the object- Returns:
- binding object
-
getMessage
Translate the given key for the given locale and arguments. If null is returned, Play's normal message translation mechanism will be used.- Parameters:
locale- the locale we wantkey- the message keyargs- arguments of the messages- Returns:
- the formatted string
-
getStatus
Return the plugin status- Returns:
- the plugin status
-
getJsonStatus
public com.google.gson.JsonObject getJsonStatus()Return the plugin status in JSON format- Returns:
- the plugin status in JSON format
-
rawInvocation
public boolean rawInvocation(Http.Request request, Http.Response response, Scope.Session session, Scope.RenderArgs renderArgs, Scope.Flash flash) throws Exception Give a chance to this plugin to fully manage this request- Parameters:
request- The Play requestresponse- The Play response- Returns:
- true if this plugin has managed this request
- Throws:
Exception
-
loadTemplate
- Parameters:
file- the file of the template to load- Returns:
- the template object
-
detectChange
public void detectChange()It's time for the plugin to detect changes. Throw an exception is the application must be reloaded. -
onApplicationStart
public void onApplicationStart()Called at application start (and at each reloading) Time to start stateful things. -
afterApplicationStart
public void afterApplicationStart()Called after the application start. -
onApplicationStop
public void onApplicationStop()Called at application stop (and before each reloading) Time to shut down stateful things. -
beforeInvocation
public void beforeInvocation()Called before a Play! invocation. Time to prepare request specific things. -
afterInvocation
public void afterInvocation()Called after an invocation. (unless an exception has been thrown). Time to close request specific things. -
onActionInvocationException
public void onActionInvocationException(@Nonnull Http.Request request, @Nonnull Http.Response response, @Nonnull Throwable e) -
onJobInvocationException
-
onJobInvocationFinally
public void onJobInvocationFinally() -
beforeActionInvocation
public void beforeActionInvocation(Http.Request request, Http.Response response, Scope.Session session, Scope.RenderArgs renderArgs, Scope.Flash flash, Method actionMethod) Called before an 'action' invocation, ie an HTTP request processing. -
onActionInvocationResult
public void onActionInvocationResult(@Nonnull Http.Request request, @Nonnull Http.Response response, @Nonnull Scope.Session session, @Nonnull Scope.Flash flash, @Nonnull Scope.RenderArgs renderArgs, @Nonnull Result result) Called when the action method has thrown a result.- Parameters:
result- The result object for the request.
-
onActionInvocationResult
@Deprecated public void onActionInvocationResult(Http.Request request, Http.Response response, Scope.Session session, Scope.RenderArgs renderArgs, Result result) Deprecated.Use/override method with flash parameter -
onInvocationSuccess
public void onInvocationSuccess() -
afterActionInvocation
public void afterActionInvocation(Http.Request request, Http.Response response, Scope.Session session, Scope.Flash flash) Called at the end of the action invocation. -
onActionInvocationFinally
public void onActionInvocationFinally(@Nonnull Http.Request request, @Nonnull Http.Response response) Called at the end of the action invocation (either in case of success or any failure). Time to close request-specific things. -
onConfigurationRead
public void onConfigurationRead()Called when the application.conf has been read. -
routeRequest
Let some plugins route themselves- Parameters:
request- the current request
-
compareTo
- Specified by:
compareToin interfaceComparable<PlayPlugin>
-