Package play
Class PlayPlugin
- java.lang.Object
-
- play.PlayPlugin
-
- All Implemented Interfaces:
java.lang.Comparable<PlayPlugin>
- Direct Known Subclasses:
AuthenticityTokenPlugin,DBBrowserPlugin,DBPlugin,ExceptionsMonitoringPlugin,JobsPlugin,JPAPlugin,MessagesPlugin,PlayStatusPlugin,TempFilePlugin,ValidationPlugin,WS
public abstract class PlayPlugin extends java.lang.Object implements java.lang.Comparable<PlayPlugin>
A framework plugin
-
-
Field Summary
Fields Modifier and Type Field Description intindexPlugin priority (0 for highest priority)
-
Constructor Summary
Constructors Constructor Description PlayPlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidafterActionInvocation(Http.Request request, Http.Response response, Scope.Session session, Scope.Flash flash)Called at the end of the action invocation.voidafterApplicationStart()Called after the application start.voidafterInvocation()Called after an invocation.voidbeforeActionInvocation(Http.Request request, Http.Response response, Scope.Session session, Scope.RenderArgs renderArgs, Scope.Flash flash, java.lang.reflect.Method actionMethod)Called before an 'action' invocation, ie an HTTP request processing.voidbeforeInvocation()Called before a Play! invocation.java.lang.Objectbind(Http.Request request, Scope.Session session, RootParamNode rootParamNode, java.lang.String name, java.lang.Class<?> clazz, java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations)Called when play need to bind a Java object from HTTP params.intcompareTo(PlayPlugin o)voiddetectChange()It's time for the plugin to detect changes.protected voiddisable()com.google.gson.JsonObjectgetJsonStatus()Return the plugin status in JSON formatjava.util.Optional<java.lang.String>getMessage(java.lang.String locale, java.lang.Object key, java.lang.Object... args)Translate the given key for the given locale and arguments.java.lang.StringgetStatus()Return the plugin statusbooleanisEnabled()java.util.Optional<Template>loadTemplate(VirtualFile file)voidonActionInvocationException(Http.Request request, Http.Response response, java.lang.Throwable e)voidonActionInvocationFinally(Http.Request request)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 parametervoidonApplicationStart()Called at application start (and at each reloading) Time to start stateful things.voidonApplicationStop()Called at application stop (and before each reloading) Time to shutdown stateful things.voidonConfigurationRead()Called when the application.conf has been read.voidonInvocationSuccess()voidonJobInvocationException(java.lang.Throwable e)voidonJobInvocationFinally()voidonLoad()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
-
-
-
Method Detail
-
disable
protected void disable()
-
isEnabled
public boolean isEnabled()
-
onLoad
public void onLoad()
Called at plugin loading
-
bind
public java.lang.Object bind(Http.Request request, Scope.Session session, RootParamNode rootParamNode, java.lang.String name, java.lang.Class<?> clazz, java.lang.reflect.Type type, java.lang.annotation.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
public java.util.Optional<java.lang.String> getMessage(java.lang.String locale, java.lang.Object key, java.lang.Object... args)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
public java.lang.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 java.lang.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:
java.lang.Exception
-
loadTemplate
public java.util.Optional<Template> loadTemplate(VirtualFile file)
- 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 shutdown 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 java.lang.Throwable e)
-
onJobInvocationException
public void onJobInvocationException(@Nonnull java.lang.Throwable e)
-
onJobInvocationFinally
public void onJobInvocationFinally()
-
beforeActionInvocation
public void beforeActionInvocation(Http.Request request, Http.Response response, Scope.Session session, Scope.RenderArgs renderArgs, Scope.Flash flash, java.lang.reflect.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)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
public void routeRequest(Http.Request request)
Let some plugins route themselves- Parameters:
request- the current request
-
compareTo
public int compareTo(PlayPlugin o)
- Specified by:
compareToin interfacejava.lang.Comparable<PlayPlugin>
-
-