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 givenClosure
as aHandler
to thisGroovyChain
.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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isDELETE
and thepath
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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isDELETE
.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 aList
ofHandler
from the givenClosure
and adds aHandler
to thisGroovyChain
that changes theFileSystemBinding
for theHandler
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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isGET
and thepath
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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isGET
.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 aHost
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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isOPTIONS
and thepath
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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isOPTIONS
.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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isPATCH
and thepath
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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isPATCH
.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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isPOST
and thepath
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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isPOST
.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 aList
ofHandler
from the givenClosure
and adds aHandler
to thisGroovyChain
that delegates to theHandler
list if the relative path starts with the givenprefix
.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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isPUT
and thepath
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 aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isPUT
.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 iftest
istrue
.default GroovyChain
when(boolean test, Closure<?> ifHandlers, Closure<?> elseHandlers)
Inlines the appropriate handlers based on the giventest
.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)
-
-
-
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
default GroovyChain all(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds the givenClosure
as aHandler
to thisGroovyChain
.- Parameters:
handler
- theClosure
to add- Returns:
- this
GroovyChain
-
all
GroovyChain all(ratpack.handling.Handler handler)
- Specified by:
all
in interfaceratpack.handling.Chain
-
all
default GroovyChain all(java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
all
in interfaceratpack.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 byclosure
-
delete
default GroovyChain delete(java.lang.String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isDELETE
.See
delete(String, ratpack.handling.Handler)
for more details.- Parameters:
path
- the relative path to match onhandler
- the handler to delegate to- Returns:
- this
GroovyChain
-
delete
default GroovyChain delete(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isDELETE
and thepath
is at the current root.See
delete(ratpack.handling.Handler)
for more details.- Parameters:
handler
- the handler to delegate to- Returns:
- this
GroovyChain
-
delete
default GroovyChain delete(java.lang.String path, ratpack.handling.Handler handler)
- Specified by:
delete
in interfaceratpack.handling.Chain
-
delete
default GroovyChain delete(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
delete
in interfaceratpack.handling.Chain
-
delete
default GroovyChain delete(ratpack.handling.Handler handler)
- Specified by:
delete
in interfaceratpack.handling.Chain
-
delete
default GroovyChain delete(java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
delete
in interfaceratpack.handling.Chain
-
fileSystem
default GroovyChain fileSystem(java.lang.String path, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> handlers) throws java.lang.Exception
Creates aList
ofHandler
from the givenClosure
and adds aHandler
to thisGroovyChain
that changes theFileSystemBinding
for theHandler
list.See
fileSystem(String, ratpack.func.Action)
for more details.- Parameters:
path
- the relativepath
to the new file system binding pointhandlers
- the definition of the handler chain- Returns:
- this
GroovyChain
- Throws:
java.lang.Exception
- any thrown byclosure
-
fileSystem
default GroovyChain fileSystem(java.lang.String path, ratpack.func.Action<? super ratpack.handling.Chain> action) throws java.lang.Exception
- Specified by:
fileSystem
in interfaceratpack.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 interfaceratpack.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 interfaceratpack.handling.Chain
- Throws:
java.lang.Exception
-
files
default GroovyChain files()
- Specified by:
files
in interfaceratpack.handling.Chain
-
files
default GroovyChain files(@DelegatesTo(value=ratpack.file.FileHandlerSpec.class,strategy=1) Closure<?> closure) throws java.lang.Exception
- Throws:
java.lang.Exception
-
get
default GroovyChain get(java.lang.String path, ratpack.handling.Handler handler)
- Specified by:
get
in interfaceratpack.handling.Chain
-
get
default GroovyChain get(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
get
in interfaceratpack.handling.Chain
-
get
default GroovyChain get(ratpack.handling.Handler handler)
- Specified by:
get
in interfaceratpack.handling.Chain
-
get
default GroovyChain get(java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
get
in interfaceratpack.handling.Chain
-
get
default GroovyChain get(java.lang.String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isGET
.See
get(String, ratpack.handling.Handler)
for more details.- Parameters:
path
- the relative path to match onhandler
- the handler to delegate to- Returns:
- this
GroovyChain
-
get
default GroovyChain get(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isGET
and thepath
is at the current root.See
get(ratpack.handling.Handler)
for more details.- Parameters:
handler
- the handler to delegate to- Returns:
- this
GroovyChain
-
host
default GroovyChain host(java.lang.String hostName, ratpack.func.Action<? super ratpack.handling.Chain> action) throws java.lang.Exception
- Specified by:
host
in interfaceratpack.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 interfaceratpack.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 aHost
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 onhandler
- the handler to delegate to- Returns:
- this
GroovyChain
- Throws:
java.lang.Exception
- any thrown byclosure
- 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 interfaceratpack.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 interfaceratpack.handling.Chain
- Throws:
java.lang.Exception
-
insert
default GroovyChain insert(@DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> closure) throws java.lang.Exception
Inserts the given nested handler chain.Shorter form of
all(Handler)
handler}(chain
(closure
).- Parameters:
closure
- the handler chain to insert- Returns:
- this
- Throws:
java.lang.Exception
- any thrown byclosure
-
patch
default GroovyChain patch(java.lang.String path, ratpack.handling.Handler handler)
- Specified by:
patch
in interfaceratpack.handling.Chain
-
patch
default GroovyChain patch(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
patch
in interfaceratpack.handling.Chain
-
patch
default GroovyChain patch(ratpack.handling.Handler handler)
- Specified by:
patch
in interfaceratpack.handling.Chain
-
patch
default GroovyChain patch(java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
patch
in interfaceratpack.handling.Chain
-
patch
default GroovyChain patch(java.lang.String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isPATCH
.See
put(String, ratpack.handling.Handler)
for more details.- Parameters:
path
- the relative path to match onhandler
- the handler to delegate to- Returns:
- this
GroovyChain
-
patch
default GroovyChain patch(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isPATCH
and thepath
is at the current root.See
put(ratpack.handling.Handler)
for more details.- Parameters:
handler
- the handler to delegate to- Returns:
- this
GroovyChain
-
options
default GroovyChain options(java.lang.String path, ratpack.handling.Handler handler)
- Specified by:
options
in interfaceratpack.handling.Chain
-
options
default GroovyChain options(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
options
in interfaceratpack.handling.Chain
-
options
default GroovyChain options(ratpack.handling.Handler handler)
- Specified by:
options
in interfaceratpack.handling.Chain
-
options
default GroovyChain options(java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
options
in interfaceratpack.handling.Chain
-
options
default GroovyChain options(java.lang.String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isOPTIONS
.See
put(String, ratpack.handling.Handler)
for more details.- Parameters:
path
- the relative path to match onhandler
- the handler to delegate to- Returns:
- this
GroovyChain
- Since:
- 1.1
-
options
default GroovyChain options(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isOPTIONS
and thepath
is at the current root.See
put(ratpack.handling.Handler)
for more details.- Parameters:
handler
- the handler to delegate to- Returns:
- this
GroovyChain
- Since:
- 1.1
-
path
default GroovyChain path(java.lang.String path, ratpack.handling.Handler handler)
- Specified by:
path
in interfaceratpack.handling.Chain
-
path
default GroovyChain path(ratpack.handling.Handler handler)
- Specified by:
path
in interfaceratpack.handling.Chain
-
path
default GroovyChain path(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
path
in interfaceratpack.handling.Chain
-
path
default GroovyChain path(java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
path
in interfaceratpack.handling.Chain
-
path
default GroovyChain path(java.lang.String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
exactly.See
path(String, ratpack.handling.Handler)
for more details.- Parameters:
path
- the relative path to match exactly onhandler
- the handler to delegate to- Returns:
- this
GroovyChain
-
path
default GroovyChain path(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
-
post
default GroovyChain post(java.lang.String path, ratpack.handling.Handler handler)
- Specified by:
post
in interfaceratpack.handling.Chain
-
post
default GroovyChain post(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
post
in interfaceratpack.handling.Chain
-
post
default GroovyChain post(ratpack.handling.Handler handler)
- Specified by:
post
in interfaceratpack.handling.Chain
-
post
default GroovyChain post(java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
post
in interfaceratpack.handling.Chain
-
post
default GroovyChain post(java.lang.String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isPOST
.See
post(String, ratpack.handling.Handler)
for more details.- Parameters:
path
- the relative path to match onhandler
- the handler to delegate to- Returns:
- this
GroovyChain
-
post
default GroovyChain post(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isPOST
and thepath
is at the current root.See
post(ratpack.handling.Handler)
for more details.- Parameters:
handler
- the handler to delegate to- Returns:
- this
GroovyChain
-
prefix
default GroovyChain prefix(java.lang.String prefix, ratpack.func.Action<? super ratpack.handling.Chain> action) throws java.lang.Exception
- Specified by:
prefix
in interfaceratpack.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 interfaceratpack.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 aList
ofHandler
from the givenClosure
and adds aHandler
to thisGroovyChain
that delegates to theHandler
list if the relative path starts with the givenprefix
.See
Chain.prefix(String, ratpack.func.Action)
for more details.- Parameters:
prefix
- the relative path to match onchain
- 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 interfaceratpack.handling.Chain
-
put
default GroovyChain put(java.lang.String path, java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
put
in interfaceratpack.handling.Chain
-
put
default GroovyChain put(ratpack.handling.Handler handler)
- Specified by:
put
in interfaceratpack.handling.Chain
-
put
default GroovyChain put(java.lang.Class<? extends ratpack.handling.Handler> handler)
- Specified by:
put
in interfaceratpack.handling.Chain
-
put
default GroovyChain put(java.lang.String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if the relativepath
matches the givenpath
and therequest
HTTPMethod
isPUT
.See
put(String, ratpack.handling.Handler)
for more details.- Parameters:
path
- the relative path to match onhandler
- the handler to delegate to- Returns:
- this
GroovyChain
-
put
default GroovyChain put(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
Adds aHandler
to thisGroovyChain
that delegates to the givenClosure
as aHandler
if therequest
HTTPMethod
isPUT
and thepath
is at the current root.See
put(ratpack.handling.Handler)
for more details.- Parameters:
handler
- the handler to delegate to- Returns:
- this
GroovyChain
-
redirect
default GroovyChain redirect(int code, java.lang.String location)
- Specified by:
redirect
in interfaceratpack.handling.Chain
-
register
default GroovyChain register(ratpack.registry.Registry registry)
- Specified by:
register
in interfaceratpack.handling.Chain
-
register
default GroovyChain register(ratpack.func.Action<? super ratpack.registry.RegistrySpec> action) throws java.lang.Exception
- Specified by:
register
in interfaceratpack.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 interfaceratpack.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 interfaceratpack.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 interfaceratpack.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 interfaceratpack.handling.Chain
- Throws:
java.lang.Exception
-
register
default GroovyChain register(ratpack.func.Action<? super ratpack.registry.RegistrySpec> registryAction, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> handler) throws java.lang.Exception
- Throws:
java.lang.Exception
-
register
default GroovyChain register(ratpack.registry.Registry registry, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> handlers) throws java.lang.Exception
- Throws:
java.lang.Exception
-
register
default GroovyChain register(@DelegatesTo(value=ratpack.registry.RegistrySpec.class,strategy=1) Closure<?> closure) throws java.lang.Exception
- 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 interfaceratpack.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 interfaceratpack.handling.Chain
- Throws:
java.lang.Exception
-
when
default GroovyChain when(ratpack.func.Predicate<? super ratpack.handling.Context> test, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> handlers) throws java.lang.Exception
- Throws:
java.lang.Exception
-
when
default GroovyChain when(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> test, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> handlers) throws java.lang.Exception
- Throws:
java.lang.Exception
-
when
default GroovyChain when(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> test, ratpack.func.Action<? super ratpack.handling.Chain> chain) throws java.lang.Exception
- 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>> action) throws java.lang.Exception
- 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 iftest
istrue
.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 actionhandlers
- the handlers to maybe include- Returns:
- this
- Throws:
java.lang.Exception
- any thrown byaction
- 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 interfaceratpack.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 interfaceratpack.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 interfaceratpack.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 interfaceratpack.handling.Chain
- Throws:
java.lang.Exception
-
when
default GroovyChain when(ratpack.func.Predicate<? super ratpack.handling.Context> test, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> ifHandlers, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> elseHandlers) throws java.lang.Exception
- Throws:
java.lang.Exception
-
when
default GroovyChain when(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> test, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> ifHandlers, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> elseHandlers) throws java.lang.Exception
- Throws:
java.lang.Exception
-
when
default GroovyChain when(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> test, ratpack.func.Action<? super ratpack.handling.Chain> ifChain, ratpack.func.Action<? super ratpack.handling.Chain> elseChain) throws java.lang.Exception
- 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 giventest
.A value of
true
will result in the givenifHandlers
being used. A value offalse
will result in the givenelseHandlers
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 includeifHandlers
- the handlers to include when the test is trueelseHandlers
- the handlers to include when the test is false- Returns:
- this
- Throws:
java.lang.Exception
- any thrown byaction
- 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 interfaceratpack.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 interfaceratpack.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 interfaceratpack.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 interfaceratpack.handling.Chain
-
onlyIf
default GroovyChain onlyIf(ratpack.func.Predicate<? super ratpack.handling.Context> test, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
-
onlyIf
default GroovyChain onlyIf(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> test, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
-
onlyIf
default GroovyChain onlyIf(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> test, ratpack.handling.Handler handler)
-
onlyIf
default GroovyChain onlyIf(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> test, java.lang.Class<? extends ratpack.handling.Handler> handler)
-
notFound
default GroovyChain notFound()
- Specified by:
notFound
in interfaceratpack.handling.Chain
-
-