Interface GroovyChain

  • All Superinterfaces:
    ratpack.handling.Chain
    All Known Implementing Classes:
    GroovyChainAction

    public interface GroovyChain
    extends ratpack.handling.Chain
    A Groovy oriented handler chain builder DSL.

    The methods specific to this subclass create Handler instances from closures and add them to the underlying chain.

    These methods are generally shortcuts for all(ratpack.handling.Handler) on this underlying chain.

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default GroovyChain all​(Closure<?> handler)
      Adds the given Closure as a Handler to this GroovyChain.
      default GroovyChain all​(java.lang.Class<? extends ratpack.handling.Handler> handler)
      GroovyChain all​(ratpack.handling.Handler handler)
      default ratpack.handling.Handler chain​(Closure<?> closure)
      Creates a handler from the given closure.
      default GroovyChain delete​(Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the request HTTPMethod is DELETE and the path is at the current root.
      default GroovyChain delete​(java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain delete​(java.lang.String path, Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the relative path matches the given path and the request HTTPMethod is DELETE.
      default GroovyChain delete​(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain delete​(java.lang.String path, ratpack.handling.Handler handler)
      default GroovyChain delete​(ratpack.handling.Handler handler)
      default GroovyChain files()  
      default GroovyChain files​(Closure<?> closure)  
      default GroovyChain files​(ratpack.func.Action<? super ratpack.file.FileHandlerSpec> config)
      default GroovyChain fileSystem​(java.lang.String path, Closure<?> handlers)
      Creates a List of Handler from the given Closure and adds a Handler to this GroovyChain that changes the FileSystemBinding for the Handler list.
      default GroovyChain fileSystem​(java.lang.String path, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
      default GroovyChain fileSystem​(java.lang.String path, ratpack.func.Action<? super ratpack.handling.Chain> action)
      static GroovyChain from​(ratpack.handling.Chain chain)
      Creates a Groovy chain wrapper over a chain instance.
      default GroovyChain get​(Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the request HTTPMethod is GET and the path is at the current root.
      default GroovyChain get​(java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain get​(java.lang.String path, Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the relative path matches the given path and the request HTTPMethod is GET.
      default GroovyChain get​(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain get​(java.lang.String path, ratpack.handling.Handler handler)
      default GroovyChain get​(ratpack.handling.Handler handler)
      default GroovyChain host​(java.lang.String hostName, Closure<?> handler)
      If the request has a Host header that matches the given host name exactly, handling will be delegated to the chain defined by the given closure.
      default GroovyChain host​(java.lang.String hostName, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
      default GroovyChain host​(java.lang.String hostName, ratpack.func.Action<? super ratpack.handling.Chain> action)
      default GroovyChain insert​(Closure<?> closure)
      Inserts the given nested handler chain.
      default GroovyChain insert​(java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
      default GroovyChain insert​(ratpack.func.Action<? super ratpack.handling.Chain> action)
      default GroovyChain notFound()
      default GroovyChain onlyIf​(Closure<?> test, Closure<?> handler)  
      default GroovyChain onlyIf​(Closure<?> test, java.lang.Class<? extends ratpack.handling.Handler> handler)  
      default GroovyChain onlyIf​(Closure<?> test, ratpack.handling.Handler handler)  
      default GroovyChain onlyIf​(ratpack.func.Predicate<? super ratpack.handling.Context> test, Closure<?> handler)  
      default GroovyChain onlyIf​(ratpack.func.Predicate<? super ratpack.handling.Context> test, java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain onlyIf​(ratpack.func.Predicate<? super ratpack.handling.Context> test, ratpack.handling.Handler handler)
      default GroovyChain options​(Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the request HTTPMethod is OPTIONS and the path is at the current root.
      default GroovyChain options​(java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain options​(java.lang.String path, Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the relative path matches the given path and the request HTTPMethod is OPTIONS.
      default GroovyChain options​(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain options​(java.lang.String path, ratpack.handling.Handler handler)
      default GroovyChain options​(ratpack.handling.Handler handler)
      default GroovyChain patch​(Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the request HTTPMethod is PATCH and the path is at the current root.
      default GroovyChain patch​(java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain patch​(java.lang.String path, Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the relative path matches the given path and the request HTTPMethod is PATCH.
      default GroovyChain patch​(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain patch​(java.lang.String path, ratpack.handling.Handler handler)
      default GroovyChain patch​(ratpack.handling.Handler handler)
      default GroovyChain path​(Closure<?> handler)  
      default GroovyChain path​(java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain path​(java.lang.String path, Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the relative path matches the given path exactly.
      default GroovyChain path​(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain path​(java.lang.String path, ratpack.handling.Handler handler)
      default GroovyChain path​(ratpack.handling.Handler handler)
      default GroovyChain post​(Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the request HTTPMethod is POST and the path is at the current root.
      default GroovyChain post​(java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain post​(java.lang.String path, Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the relative path matches the given path and the request HTTPMethod is POST.
      default GroovyChain post​(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain post​(java.lang.String path, ratpack.handling.Handler handler)
      default GroovyChain post​(ratpack.handling.Handler handler)
      default GroovyChain prefix​(java.lang.String prefix, Closure<?> chain)
      Creates a List of Handler from the given Closure and adds a Handler to this GroovyChain that delegates to the Handler list if the relative path starts with the given prefix.
      default GroovyChain prefix​(java.lang.String prefix, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
      default GroovyChain prefix​(java.lang.String prefix, ratpack.func.Action<? super ratpack.handling.Chain> action)
      default GroovyChain put​(Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the request HTTPMethod is PUT and the path is at the current root.
      default GroovyChain put​(java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain put​(java.lang.String path, Closure<?> handler)
      Adds a Handler to this GroovyChain that delegates to the given Closure as a Handler if the relative path matches the given path and the request HTTPMethod is PUT.
      default GroovyChain put​(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
      default GroovyChain put​(java.lang.String path, ratpack.handling.Handler handler)
      default GroovyChain put​(ratpack.handling.Handler handler)
      default GroovyChain redirect​(int code, java.lang.String location)
      default GroovyChain register​(Closure<?> closure)  
      default GroovyChain register​(ratpack.func.Action<? super ratpack.registry.RegistrySpec> action)
      default GroovyChain register​(ratpack.func.Action<? super ratpack.registry.RegistrySpec> registryAction, Closure<?> handler)  
      default GroovyChain register​(ratpack.func.Action<? super ratpack.registry.RegistrySpec> registryAction, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
      default GroovyChain register​(ratpack.func.Action<? super ratpack.registry.RegistrySpec> registryAction, ratpack.func.Action<? super ratpack.handling.Chain> chainAction)
      default GroovyChain register​(ratpack.registry.Registry registry)
      default GroovyChain register​(ratpack.registry.Registry registry, Closure<?> handlers)  
      default GroovyChain register​(ratpack.registry.Registry registry, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
      default GroovyChain register​(ratpack.registry.Registry registry, ratpack.func.Action<? super ratpack.handling.Chain> action)
      default GroovyChain when​(boolean test, Closure<?> handlers)
      Inlines the given handlers if test is true.
      default GroovyChain when​(boolean test, Closure<?> ifHandlers, Closure<?> elseHandlers)
      Inlines the appropriate handlers based on the given test.
      default GroovyChain when​(boolean test, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
      default GroovyChain when​(boolean test, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> onTrue, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> onFalse)
      default GroovyChain when​(boolean test, ratpack.func.Action<? super ratpack.handling.Chain> action)
      default GroovyChain when​(boolean test, ratpack.func.Action<? super ratpack.handling.Chain> onTrue, ratpack.func.Action<? super ratpack.handling.Chain> onFalse)
      default GroovyChain when​(Closure<?> test, Closure<?> handlers)  
      default GroovyChain when​(Closure<?> test, Closure<?> ifHandlers, Closure<?> elseHandlers)  
      default GroovyChain when​(Closure<?> test, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)  
      default GroovyChain when​(Closure<?> test, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> ifAction, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> elseAction)  
      default GroovyChain when​(Closure<?> test, ratpack.func.Action<? super ratpack.handling.Chain> chain)  
      default GroovyChain when​(Closure<?> test, ratpack.func.Action<? super ratpack.handling.Chain> ifChain, ratpack.func.Action<? super ratpack.handling.Chain> elseChain)  
      default GroovyChain when​(ratpack.func.Predicate<? super ratpack.handling.Context> test, Closure<?> handlers)  
      default GroovyChain when​(ratpack.func.Predicate<? super ratpack.handling.Context> test, Closure<?> ifHandlers, Closure<?> elseHandlers)  
      default GroovyChain when​(ratpack.func.Predicate<? super ratpack.handling.Context> test, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)  
      default GroovyChain when​(ratpack.func.Predicate<? super ratpack.handling.Context> test, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> onTrue, java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> onFalse)  
      default GroovyChain when​(ratpack.func.Predicate<? super ratpack.handling.Context> test, ratpack.func.Action<? super ratpack.handling.Chain> action)  
      default GroovyChain when​(ratpack.func.Predicate<? super ratpack.handling.Context> test, ratpack.func.Action<? super ratpack.handling.Chain> onTrue, ratpack.func.Action<? super ratpack.handling.Chain> onFalse)  
      • Methods inherited from interface ratpack.handling.Chain

        chain, chain, getRegistry, getServerConfig
    • Method Detail

      • from

        static GroovyChain from​(ratpack.handling.Chain chain)
        Creates a Groovy chain wrapper over a chain instance.
        Parameters:
        chain - a chain instance
        Returns:
        a Groovy wrapper
      • all

        GroovyChain all​(ratpack.handling.Handler handler)
        Specified by:
        all in interface ratpack.handling.Chain
      • all

        default GroovyChain all​(java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        all in interface ratpack.handling.Chain
      • chain

        default ratpack.handling.Handler chain​(@DelegatesTo(value=GroovyChain.class,strategy=1)
                                               Closure<?> closure)
                                        throws java.lang.Exception
        Creates a handler from the given closure.
        Parameters:
        closure - a chain definition
        Returns:
        a new handler
        Throws:
        java.lang.Exception - any thrown by closure
      • delete

        default GroovyChain delete​(java.lang.String path,
                                   ratpack.handling.Handler handler)
        Specified by:
        delete in interface ratpack.handling.Chain
      • delete

        default GroovyChain delete​(java.lang.String path,
                                   java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        delete in interface ratpack.handling.Chain
      • delete

        default GroovyChain delete​(ratpack.handling.Handler handler)
        Specified by:
        delete in interface ratpack.handling.Chain
      • delete

        default GroovyChain delete​(java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        delete in interface ratpack.handling.Chain
      • fileSystem

        default GroovyChain fileSystem​(java.lang.String path,
                                       @DelegatesTo(value=GroovyChain.class,strategy=1)
                                       Closure<?> handlers)
                                throws java.lang.Exception
        Creates a List of Handler from the given Closure and adds a Handler to this GroovyChain that changes the FileSystemBinding for the Handler list.

        See fileSystem(String, ratpack.func.Action) for more details.

        Parameters:
        path - the relative path to the new file system binding point
        handlers - the definition of the handler chain
        Returns:
        this GroovyChain
        Throws:
        java.lang.Exception - any thrown by closure
      • fileSystem

        default GroovyChain fileSystem​(java.lang.String path,
                                       ratpack.func.Action<? super ratpack.handling.Chain> action)
                                throws java.lang.Exception
        Specified by:
        fileSystem in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • fileSystem

        default GroovyChain fileSystem​(java.lang.String path,
                                       java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
                                throws java.lang.Exception
        Specified by:
        fileSystem in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • files

        default GroovyChain files​(ratpack.func.Action<? super ratpack.file.FileHandlerSpec> config)
                           throws java.lang.Exception
        Specified by:
        files in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • files

        default GroovyChain files()
        Specified by:
        files in interface ratpack.handling.Chain
      • get

        default GroovyChain get​(java.lang.String path,
                                ratpack.handling.Handler handler)
        Specified by:
        get in interface ratpack.handling.Chain
      • get

        default GroovyChain get​(java.lang.String path,
                                java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        get in interface ratpack.handling.Chain
      • get

        default GroovyChain get​(ratpack.handling.Handler handler)
        Specified by:
        get in interface ratpack.handling.Chain
      • get

        default GroovyChain get​(java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        get in interface ratpack.handling.Chain
      • host

        default GroovyChain host​(java.lang.String hostName,
                                 ratpack.func.Action<? super ratpack.handling.Chain> action)
                          throws java.lang.Exception
        Specified by:
        host in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • host

        default GroovyChain host​(java.lang.String hostName,
                                 java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
                          throws java.lang.Exception
        Specified by:
        host in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • host

        default GroovyChain host​(java.lang.String hostName,
                                 @DelegatesTo(value=GroovyChain.class,strategy=1)
                                 Closure<?> handler)
                          throws java.lang.Exception
        If the request has a Host header that matches the given host name exactly, handling will be delegated to the chain defined by the given closure.
        Parameters:
        hostName - the name of the HTTP Header to match on
        handler - the handler to delegate to
        Returns:
        this GroovyChain
        Throws:
        java.lang.Exception - any thrown by closure
        See Also:
        host(String, ratpack.func.Action)
      • insert

        default GroovyChain insert​(ratpack.func.Action<? super ratpack.handling.Chain> action)
                            throws java.lang.Exception
        Specified by:
        insert in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • insert

        default GroovyChain insert​(java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
                            throws java.lang.Exception
        Specified by:
        insert in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • patch

        default GroovyChain patch​(java.lang.String path,
                                  ratpack.handling.Handler handler)
        Specified by:
        patch in interface ratpack.handling.Chain
      • patch

        default GroovyChain patch​(java.lang.String path,
                                  java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        patch in interface ratpack.handling.Chain
      • patch

        default GroovyChain patch​(ratpack.handling.Handler handler)
        Specified by:
        patch in interface ratpack.handling.Chain
      • patch

        default GroovyChain patch​(java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        patch in interface ratpack.handling.Chain
      • options

        default GroovyChain options​(java.lang.String path,
                                    ratpack.handling.Handler handler)
        Specified by:
        options in interface ratpack.handling.Chain
      • options

        default GroovyChain options​(java.lang.String path,
                                    java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        options in interface ratpack.handling.Chain
      • options

        default GroovyChain options​(ratpack.handling.Handler handler)
        Specified by:
        options in interface ratpack.handling.Chain
      • options

        default GroovyChain options​(java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        options in interface ratpack.handling.Chain
      • path

        default GroovyChain path​(java.lang.String path,
                                 ratpack.handling.Handler handler)
        Specified by:
        path in interface ratpack.handling.Chain
      • path

        default GroovyChain path​(ratpack.handling.Handler handler)
        Specified by:
        path in interface ratpack.handling.Chain
      • path

        default GroovyChain path​(java.lang.String path,
                                 java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        path in interface ratpack.handling.Chain
      • path

        default GroovyChain path​(java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        path in interface ratpack.handling.Chain
      • post

        default GroovyChain post​(java.lang.String path,
                                 ratpack.handling.Handler handler)
        Specified by:
        post in interface ratpack.handling.Chain
      • post

        default GroovyChain post​(java.lang.String path,
                                 java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        post in interface ratpack.handling.Chain
      • post

        default GroovyChain post​(ratpack.handling.Handler handler)
        Specified by:
        post in interface ratpack.handling.Chain
      • post

        default GroovyChain post​(java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        post in interface ratpack.handling.Chain
      • prefix

        default GroovyChain prefix​(java.lang.String prefix,
                                   ratpack.func.Action<? super ratpack.handling.Chain> action)
                            throws java.lang.Exception
        Specified by:
        prefix in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • prefix

        default GroovyChain prefix​(java.lang.String prefix,
                                   java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
                            throws java.lang.Exception
        Specified by:
        prefix in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • prefix

        default GroovyChain prefix​(java.lang.String prefix,
                                   @DelegatesTo(value=GroovyChain.class,strategy=1)
                                   Closure<?> chain)
                            throws java.lang.Exception
        Creates a List of Handler from the given Closure and adds a Handler to this GroovyChain that delegates to the Handler list if the relative path starts with the given prefix.

        See Chain.prefix(String, ratpack.func.Action) for more details.

        Parameters:
        prefix - the relative path to match on
        chain - the definition of the chain to delegate to
        Returns:
        this GroovyChain
        Throws:
        java.lang.Exception - any exception thrown by the given closure
      • put

        default GroovyChain put​(java.lang.String path,
                                ratpack.handling.Handler handler)
        Specified by:
        put in interface ratpack.handling.Chain
      • put

        default GroovyChain put​(java.lang.String path,
                                java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        put in interface ratpack.handling.Chain
      • put

        default GroovyChain put​(ratpack.handling.Handler handler)
        Specified by:
        put in interface ratpack.handling.Chain
      • put

        default GroovyChain put​(java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        put in interface ratpack.handling.Chain
      • redirect

        default GroovyChain redirect​(int code,
                                     java.lang.String location)
        Specified by:
        redirect in interface ratpack.handling.Chain
      • register

        default GroovyChain register​(ratpack.registry.Registry registry)
        Specified by:
        register in interface ratpack.handling.Chain
      • register

        default GroovyChain register​(ratpack.func.Action<? super ratpack.registry.RegistrySpec> action)
                              throws java.lang.Exception
        Specified by:
        register in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • register

        default GroovyChain register​(ratpack.registry.Registry registry,
                                     ratpack.func.Action<? super ratpack.handling.Chain> action)
                              throws java.lang.Exception
        Specified by:
        register in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • register

        default GroovyChain register​(ratpack.registry.Registry registry,
                                     java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
                              throws java.lang.Exception
        Specified by:
        register in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • register

        default GroovyChain register​(ratpack.func.Action<? super ratpack.registry.RegistrySpec> registryAction,
                                     ratpack.func.Action<? super ratpack.handling.Chain> chainAction)
                              throws java.lang.Exception
        Specified by:
        register in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • register

        default GroovyChain register​(ratpack.func.Action<? super ratpack.registry.RegistrySpec> registryAction,
                                     java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
                              throws java.lang.Exception
        Specified by:
        register in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • when

        default GroovyChain when​(ratpack.func.Predicate<? super ratpack.handling.Context> test,
                                 ratpack.func.Action<? super ratpack.handling.Chain> action)
                          throws java.lang.Exception
        Specified by:
        when in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • when

        default GroovyChain when​(ratpack.func.Predicate<? super ratpack.handling.Context> test,
                                 java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
                          throws java.lang.Exception
        Specified by:
        when in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • when

        default GroovyChain when​(boolean test,
                                 @DelegatesTo(value=GroovyChain.class,strategy=1)
                                 Closure<?> handlers)
                          throws java.lang.Exception
        Inlines the given handlers if test is true.

        This is literally just sugar for wrapping the given action in an if statement. It can be useful when conditionally adding handlers based on state available when building the chain.

        Parameters:
        test - whether to include the given chain action
        handlers - the handlers to maybe include
        Returns:
        this
        Throws:
        java.lang.Exception - any thrown by action
        Since:
        1.4
        See Also:
        Chain.when(boolean, Action)
      • when

        default GroovyChain when​(boolean test,
                                 ratpack.func.Action<? super ratpack.handling.Chain> action)
                          throws java.lang.Exception
        Specified by:
        when in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • when

        default GroovyChain when​(boolean test,
                                 java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> action)
                          throws java.lang.Exception
        Specified by:
        when in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • when

        default GroovyChain when​(ratpack.func.Predicate<? super ratpack.handling.Context> test,
                                 ratpack.func.Action<? super ratpack.handling.Chain> onTrue,
                                 ratpack.func.Action<? super ratpack.handling.Chain> onFalse)
                          throws java.lang.Exception
        Specified by:
        when in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • when

        default GroovyChain when​(ratpack.func.Predicate<? super ratpack.handling.Context> test,
                                 java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> onTrue,
                                 java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> onFalse)
                          throws java.lang.Exception
        Specified by:
        when in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • when

        default GroovyChain when​(@DelegatesTo(value=GroovyContext.class,strategy=1)
                                 Closure<?> test,
                                 java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> ifAction,
                                 java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> elseAction)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • when

        default GroovyChain when​(boolean test,
                                 @DelegatesTo(value=GroovyChain.class,strategy=1)
                                 Closure<?> ifHandlers,
                                 @DelegatesTo(value=GroovyChain.class,strategy=1)
                                 Closure<?> elseHandlers)
                          throws java.lang.Exception
        Inlines the appropriate handlers based on the given test.

        A value of true will result in the given ifHandlers being used. A value of false will result in the given elseHandlers being used.

        This is literally just sugar for wrapping the given action in an if/else statement. It can be useful when conditionally adding handlers based on state available when building the chain.

        Parameters:
        test - predicate to decide which handlers to include
        ifHandlers - the handlers to include when the test is true
        elseHandlers - the handlers to include when the test is false
        Returns:
        this
        Throws:
        java.lang.Exception - any thrown by action
        Since:
        1.5
        See Also:
        Chain.when(boolean, Action, Action)
      • when

        default GroovyChain when​(boolean test,
                                 ratpack.func.Action<? super ratpack.handling.Chain> onTrue,
                                 ratpack.func.Action<? super ratpack.handling.Chain> onFalse)
                          throws java.lang.Exception
        Specified by:
        when in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • when

        default GroovyChain when​(boolean test,
                                 java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> onTrue,
                                 java.lang.Class<? extends ratpack.func.Action<? super ratpack.handling.Chain>> onFalse)
                          throws java.lang.Exception
        Specified by:
        when in interface ratpack.handling.Chain
        Throws:
        java.lang.Exception
      • onlyIf

        default GroovyChain onlyIf​(ratpack.func.Predicate<? super ratpack.handling.Context> test,
                                   ratpack.handling.Handler handler)
        Specified by:
        onlyIf in interface ratpack.handling.Chain
      • onlyIf

        default GroovyChain onlyIf​(ratpack.func.Predicate<? super ratpack.handling.Context> test,
                                   java.lang.Class<? extends ratpack.handling.Handler> handler)
        Specified by:
        onlyIf in interface ratpack.handling.Chain
      • notFound

        default GroovyChain notFound()
        Specified by:
        notFound in interface ratpack.handling.Chain