Package play

Class PlayPlugin

    • Field Detail

      • index

        public int index
        Plugin priority (0 for highest priority)
    • Constructor Detail

      • PlayPlugin

        public PlayPlugin()
    • 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 bind
        name - the name of the object
        clazz - the class of the object to bind
        type - type
        annotations - 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 want
        key - the message key
        args - 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 request
        response - 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()
      • 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.
      • onInvocationSuccess

        public void onInvocationSuccess()
      • 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:
        compareTo in interface java.lang.Comparable<PlayPlugin>