public abstract class GroovyChainAction extends Object implements Action<Chain>, GroovyChain
Implementations can naturally use the GroovyChain
DSL in their implementation of execute()
.
import ratpack.groovy.handling.GroovyChainAction import ratpack.test.embed.PathBaseDirBuilder import ratpack.groovy.test.TestHttpClients import ratpack.groovy.test.embed.ClosureBackedEmbeddedApplication def baseDir = new PathBaseDirBuilder(new File("some/dir")) def app = new ClosureBackedEmbeddedApplication(baseDir) app.handlers { get("someHandler") { render "someHandler" } // Include the handlers defined in OtherHandlers handler chain(new OtherHandlers()) } // In another file… class OtherHandlers extends GroovyChainAction { protected void execute() { // The GroovyChain DSL can be used in this method get("foo") { render "foo" } get("bar") { render "bar" } } } // Functionally test the whole app… def client = TestHttpClients.testHttpClient(app) assert client.getText("someHandler") == "someHandler" assert client.getText("foo") == "foo" assert client.getText("bar") == "bar" app.close() // Factoring out into GroovyChainAction implementations mean they can be unit tested in isolation… import ratpack.handling.Handlers import ratpack.test.MockLaunchConfig import static ratpack.groovy.test.GroovyUnitTest.invoke def launchConfig = new MockLaunchConfig() def handler = Handlers.chain(launchConfig, new OtherHandlers()) assert invoke(handler) { uri "bar" }.rendered(String) == "bar" assert invoke(handler) { uri "foo" }.rendered(String) == "foo"
This class implements the GroovyChain
interface by delegating each method to the chain returned by getChain()
.
This method only returns a value during execution of execute(Chain)
, which is the given chain available as a GroovyChain
.
Constructor and Description |
---|
GroovyChainAction() |
Modifier and Type | Method and Description |
---|---|
GroovyChain |
assets(String path,
String... indexFiles)
Adds a handler that serves static assets at the given file system path, relative to the contextual file system binding.
|
Handler |
chain(Action<? super Chain> action)
Constructs a handler using the given action to define a chain.
|
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. |
GroovyChain |
delete(Handler handler)
Adds a handler that delegates to the given handler if
the
request HTTPMethod is DELETE and the path is at the current root. |
GroovyChain |
delete(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 . |
GroovyChain |
delete(String path,
Handler handler)
Adds a handler that delegates to the given handler if
the relative
path matches the given path and the request HTTPMethod
is DELETE . |
protected abstract void |
execute()
Implementations can naturally use the
GroovyChain DSL for the duration of this method. |
void |
execute(Chain chain)
Delegates to
execute() , using the given chain for delegation. |
GroovyChain |
fileSystem(String path,
Action<? super Chain> action)
Adds a handler to this chain that changes the
FileSystemBinding for the given handler chain. |
GroovyChain |
fileSystem(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. |
GroovyChain |
fileSystem(String path,
Handler handler)
Adds a handler to this chain that changes the
FileSystemBinding for the given handler. |
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. |
GroovyChain |
get(Handler handler)
Adds a handler that delegates to the given handler
if the
request HTTPMethod is GET and the path is at the
current root. |
GroovyChain |
get(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 . |
GroovyChain |
get(String path,
Handler handler)
Adds a handler that delegates to the given handler
if the relative
path matches the given path and the request
HTTPMethod is GET . |
protected GroovyChain |
getChain() |
LaunchConfig |
getLaunchConfig()
The launch config of the application that this chain is being created for.
|
Registry |
getRegistry()
The registry that backs this.
|
GroovyChain |
handler(Closure<?> handler)
Adds the given
Closure as a Handler to this GroovyChain . |
GroovyChain |
handler(Handler handler)
Adds the given handler to this.
|
GroovyChain |
handler(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. |
GroovyChain |
handler(String path,
Handler handler)
Adds a handler that delegates to the given handler if the relative
path
matches the given path exactly. |
GroovyChain |
header(String headerName,
String headerValue,
Closure<?> handler)
Adds a
Handler to this GroovyChain that delegates to the given Closure as a Handler if the request
has a HTTPHeader with the given name and a it's value matches the given value exactly. |
GroovyChain |
header(String headerName,
String headerValue,
Handler handler)
Adds a handler to the chain that delegates to the given handler if the request has a header with the given name and a its value matches the given value exactly.
|
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. |
GroovyChain |
patch(Handler handler)
Adds a handler that delegates to the given handler if
the
request HTTPMethod is PATCH and the path is at the current root. |
GroovyChain |
patch(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 . |
GroovyChain |
patch(String path,
Handler handler)
Adds a handler that delegates to the given handler if
the relative
path matches the given path and the request HTTPMethod
is PATCH . |
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. |
GroovyChain |
post(Handler handler)
Adds a handler that delegates to the given handler if
the
request HTTPMethod is POST and the path is at the current root. |
GroovyChain |
post(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 . |
GroovyChain |
post(String path,
Handler handler)
Adds a handler that delegates to the given handler if
the relative
path matches the given path and the request HTTPMethod
is POST . |
GroovyChain |
prefix(String prefix,
Action<? super Chain> action)
Adds a handler that delegates to the given handlers if the
relative path starts with the given
prefix . |
GroovyChain |
prefix(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 . |
GroovyChain |
prefix(String prefix,
Handler handler)
Adds a handler that delegates to the given handler if the relative path starts with the given
prefix . |
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. |
GroovyChain |
put(Handler handler)
Adds a handler that delegates to the given handler if
the
request HTTPMethod is PUT and the path is at the current root. |
GroovyChain |
put(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 . |
GroovyChain |
put(String path,
Handler handler)
Adds a handler that delegates to the given handler if
the relative
path matches the given path and the request HTTPMethod
is PUT . |
<T> GroovyChain |
register(Class<? super T> type,
T service,
Action<? super Chain> action)
Adds a handler to this chain that inserts the given handler chain with the given service addition.
|
<T> GroovyChain |
register(Class<? super T> type,
T service,
Closure<?> handlers)
Creates a
List of Handler from the given Closure and adds a Handler to this GroovyChain that
inserts the the Handler list with the given service addition. |
<T> GroovyChain |
register(Class<? super T> type,
T object,
Handler handler)
Adds a handler that inserts the given handlers with the given service addition.
|
GroovyChain |
register(Object service,
Action<? super Chain> action)
Adds a handler to this chain that inserts the given handler with the given service addition.
|
GroovyChain |
register(Object service,
Closure<?> handlers)
Creates a
List of Handler from the given Closure and adds a Handler to this GroovyChain
that inserts the Handler list with the given service addition. |
GroovyChain |
register(Object object,
Handler handler)
Adds a handler that inserts the given handler with the given service addition.
|
protected GroovyChain getChain() throws IllegalStateException
IllegalStateException
public final void execute(Chain chain) throws Exception
execute()
, using the given chain
for delegation.protected abstract void execute() throws Exception
GroovyChain
DSL for the duration of this method.
See the class level documentation
for an implementation example.
Exception
- Any exception thrown while defining the handlerspublic GroovyChain handler(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
Closure
as a Handler
to this GroovyChain
.handler
in interface GroovyChain
handler
- the Closure
to addGroovyChain
public GroovyChain handler(String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
Handler
to this GroovyChain
that delegates to the given Closure
as a Handler
if the
relative path
matches the given path
exactly.
See GroovyChain.handler(String, ratpack.handling.Handler)
for more details.
handler
in interface GroovyChain
path
- the relative path to match exactly onhandler
- the handler to delegate toGroovyChain
public GroovyChain handler(Handler handler)
GroovyChain
handler
in interface GroovyChain
handler
in interface Chain
handler
- the handler to addpublic GroovyChain prefix(String prefix, Handler handler)
GroovyChain
prefix
.
All path based handlers become relative to the given prefix
.
See Handlers.prefix(String, Handler)
for format details on the prefix
string.
prefix
in interface GroovyChain
prefix
in interface Chain
prefix
- the relative path to match onhandler
- the handler to delegate to if the prefix matchespublic GroovyChain prefix(String prefix, Action<? super Chain> action) throws Exception
GroovyChain
prefix
.
All path based handlers become relative to the given prefix
.
chain .prefix("person/:id", new Action<Chain>() { public void execute(Chain personChain) { personChain .get("info", new Handler() { public void handle(Context context) { // e.g. /person/2/info } }) .post("save", new Handler() { public void handle(Context context) { // e.g. /person/2/save } }) .prefix("child/:childId", new Action<Chain>() { public void execute(Chain childChain) { childChain .get("info", new Handler() { public void handle(Context context) { // e.g. /person/2/child/1/info } }); } }); } });
See Handlers.prefix(String, Handler)
for format details on the prefix
string.
prefix
in interface GroovyChain
prefix
in interface Chain
prefix
- the relative path to match onaction
- the handler chain to delegate to if the prefix matchesException
- any thrown by action
public GroovyChain prefix(String prefix, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> chain) throws Exception
GroovyChain
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.handling.Handler)
for more details.
prefix
in interface GroovyChain
prefix
- the relative path to match onchain
- the definition of the chain to delegate toGroovyChain
Exception
- any exception thrown by the given closurepublic GroovyChain handler(String path, Handler handler)
GroovyChain
path
matches the given path
exactly.
Nesting path
handlers will not work due to the exact matching, use a combination of path
and prefix
instead. See Chain.prefix(String, Handler)
for details.
// this will not work path("person/:id") { path("child/:childId") { // a request of /person/2/child/1 will not get passed the first handler as it will try // to match "person/2/child/1" with "person/2" which does not match } // this will work prefix("person/:id") { path("child/:childId") { // a request of /person/2/child/1 will work this time } }
See Handlers.path(String, Handler)
for the details on how path
is interpreted.
handler
in interface GroovyChain
handler
in interface Chain
path
- the relative path to match exactly onhandler
- the handler to delegate toChain.post(String, Handler)
,
Chain.get(String, Handler)
,
Chain.put(String, Handler)
,
Chain.patch(String, Handler)
,
Chain.delete(String, Handler)
public GroovyChain get(Handler handler)
GroovyChain
request
HTTPMethod
is GET
and the path
is at the
current root.get
in interface GroovyChain
get
in interface Chain
handler
- the handler to delegate toChain.post(Handler)
,
Chain.put(Handler)
,
Chain.patch(Handler)
,
Chain.delete(Handler)
public GroovyChain get(String path, Handler handler)
GroovyChain
path
matches the given path
and the request
HTTPMethod
is GET
.
get
in interface GroovyChain
get
in interface Chain
path
- the relative path to match onhandler
- the handler to delegate toChain.post(String, Handler)
,
Chain.put(String, Handler)
,
Chain.patch(String, Handler)
,
Chain.delete(String, Handler)
,
Chain.handler(String, Handler)
public GroovyChain get(String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
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
.
See GroovyChain.get(String, ratpack.handling.Handler)
for more details.
get
in interface GroovyChain
path
- the relative path to match onhandler
- the handler to delegate toGroovyChain
public GroovyChain get(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
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.
See GroovyChain.get(ratpack.handling.Handler)
for more details.
get
in interface GroovyChain
handler
- the handler to delegate toGroovyChain
public GroovyChain post(String path, Handler handler)
GroovyChain
path
matches the given path
and the request
HTTPMethod
is POST
.
post
in interface GroovyChain
post
in interface Chain
path
- the relative path to match onhandler
- the handler to delegate toChain.get(String, Handler)
,
Chain.put(String, Handler)
,
Chain.patch(String, Handler)
,
Chain.delete(String, Handler)
,
Chain.handler(String, Handler)
public GroovyChain post(String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
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
.
See GroovyChain.post(String, ratpack.handling.Handler)
for more details.
post
in interface GroovyChain
path
- the relative path to match onhandler
- the handler to delegate toGroovyChain
public GroovyChain post(Handler handler)
GroovyChain
request
HTTPMethod
is POST
and the path
is at the current root.
post
in interface GroovyChain
post
in interface Chain
handler
- the handler to delegate toChain.get(Handler)
,
Chain.put(Handler)
,
Chain.patch(Handler)
,
Chain.delete(Handler)
public GroovyChain post(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
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.
See GroovyChain.post(ratpack.handling.Handler)
for more details.
post
in interface GroovyChain
handler
- the handler to delegate toGroovyChain
public GroovyChain put(Handler handler)
GroovyChain
request
HTTPMethod
is PUT
and the path
is at the current root.put
in interface GroovyChain
put
in interface Chain
handler
- the handler to delegate toChain.get(Handler)
,
Chain.post(Handler)
,
Chain.patch(Handler)
,
Chain.delete(Handler)
public GroovyChain put(String path, Handler handler)
GroovyChain
path
matches the given path
and the request
HTTPMethod
is PUT
.put
in interface GroovyChain
put
in interface Chain
path
- the relative path to match onhandler
- the handler to delegate toChain.get(String, Handler)
,
Chain.post(String, Handler)
,
Chain.patch(String, Handler)
,
Chain.delete(String, Handler)
,
Chain.handler(String, Handler)
public GroovyChain put(String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
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
.
See GroovyChain.put(String, ratpack.handling.Handler)
for more details.
put
in interface GroovyChain
path
- the relative path to match onhandler
- the handler to delegate toGroovyChain
public GroovyChain put(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
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.
See GroovyChain.put(ratpack.handling.Handler)
for more details.
put
in interface GroovyChain
handler
- the handler to delegate toGroovyChain
public GroovyChain patch(Handler handler)
GroovyChain
request
HTTPMethod
is PATCH
and the path
is at the current root.patch
in interface GroovyChain
patch
in interface Chain
handler
- the handler to delegate toChain.get(Handler)
,
Chain.post(Handler)
,
Chain.put(Handler)
,
Chain.delete(Handler)
public GroovyChain patch(String path, Handler handler)
GroovyChain
path
matches the given path
and the request
HTTPMethod
is PATCH
.patch
in interface GroovyChain
patch
in interface Chain
path
- the relative path to match onhandler
- the handler to delegate toChain.get(String, Handler)
,
Chain.post(String, Handler)
,
Chain.put(String, Handler)
,
Chain.delete(String, Handler)
,
Chain.handler(String, Handler)
public GroovyChain patch(String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
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
.
See GroovyChain.put(String, ratpack.handling.Handler)
for more details.
patch
in interface GroovyChain
path
- the relative path to match onhandler
- the handler to delegate toGroovyChain
public GroovyChain patch(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
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.
See GroovyChain.put(ratpack.handling.Handler)
for more details.
patch
in interface GroovyChain
handler
- the handler to delegate toGroovyChain
public GroovyChain delete(Handler handler)
GroovyChain
request
HTTPMethod
is DELETE
and the path
is at the current root.delete
in interface GroovyChain
delete
in interface Chain
handler
- the handler to delegate toChain.get(Handler)
,
Chain.post(Handler)
,
Chain.put(Handler)
,
Chain.patch(Handler)
public GroovyChain delete(String path, Handler handler)
GroovyChain
path
matches the given path
and the request
HTTPMethod
is DELETE
.delete
in interface GroovyChain
delete
in interface Chain
path
- the relative path to match onhandler
- the handler to delegate toChain.get(String, Handler)
,
Chain.post(String, Handler)
,
Chain.put(String, Handler)
,
Chain.patch(String, Handler)
,
Chain.handler(String, Handler)
public GroovyChain delete(String path, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
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
.
See GroovyChain.delete(String, ratpack.handling.Handler)
for more details.
delete
in interface GroovyChain
path
- the relative path to match onhandler
- the handler to delegate toGroovyChain
public GroovyChain delete(@DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
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.
See GroovyChain.delete(ratpack.handling.Handler)
for more details.
delete
in interface GroovyChain
handler
- the handler to delegate toGroovyChain
public GroovyChain register(Object object, Handler handler)
GroovyChain
The service object will be available by its concrete type.
See Handlers.register(Object, Handler)
for more details on the handler created
register
in interface GroovyChain
register
in interface Chain
object
- the object to add to the service for the handlershandler
- the handlers to register the service withChain.register(Class, Object, Handler)
public GroovyChain register(Object service, Action<? super Chain> action) throws Exception
GroovyChain
The service object will be available by its concrete type.
See Handlers.register(Object, Handler)
for more details on the handler created
register
in interface GroovyChain
register
in interface Chain
service
- the object to add to the service for the handlersaction
- the handlers to register the service withException
- any thrown by action
Chain.register(Class, Object, Handler)
public GroovyChain register(Object service, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> handlers) throws Exception
GroovyChain
List
of Handler
from the given Closure
and adds a Handler
to this GroovyChain
that inserts the Handler
list with the given service
addition.
See GroovyChain.register(Object, Handler)
for more details.
register
in interface GroovyChain
service
- the object to add to the service for the handlershandlers
- the handlers to register the service withGroovyChain
Exception
- any exception thrown by the given closurepublic <T> GroovyChain register(Class<? super T> type, T object, Handler handler)
GroovyChain
The service object will be available by the given type.
See Handlers.register(Class, Object, Handler)
for more details on the handler created
register
in interface GroovyChain
register
in interface Chain
T
- the concrete type of the service additiontype
- the Type
by which to make the service object availableobject
- the object to add to the service for the handlershandler
- the handlers to register the service withChain.register(Object, Handler)
public <T> GroovyChain register(Class<? super T> type, T service, Action<? super Chain> action) throws Exception
Chain
The service object will be available by the given type.
See Handlers.register(Class, Object, Handler)
for more details on the handler created
register
in interface GroovyChain
register
in interface Chain
T
- the concrete type of the service additiontype
- the Type
by which to make the service object availableservice
- the object to add to the service for the handlersaction
- the handlers which to register the service forException
- any thrown by action
Chain.register(Object, Handler)
public <T> GroovyChain register(Class<? super T> type, T service, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> handlers) throws Exception
GroovyChain
List
of Handler
from the given Closure
and adds a Handler
to this GroovyChain
that
inserts the the Handler
list with the given service
addition.
See GroovyChain.register(Class, Object, Handler)
for more details.
register
in interface GroovyChain
T
- the concrete type of the service additiontype
- the Type
by which to make the service object availableservice
- the object to add to the service for the handlershandlers
- the handlers to register the service withGroovyChain
Exception
- any exception thrown by the given closurepublic GroovyChain assets(String path, String... indexFiles)
GroovyChain
See Handlers.assets(String, java.util.List)
for more details on the handler created
prefix("foo") { assets("d1", "index.html", "index.xhtml") }In the above configuration a request like "/foo/app.js" will return the static file "app.js" that is located in the directory "d1".
If the request matches a directory e.g. "/foo", an index file may be served. The indexFiles
array specifies the names of files to look for in order to serve.
assets
in interface GroovyChain
assets
in interface Chain
path
- the relative path to the location of the assets to serveindexFiles
- the index files to try if the request is for a directorypublic GroovyChain fileSystem(String path, Handler handler)
GroovyChain
FileSystemBinding
for the given handler.fileSystem
in interface GroovyChain
fileSystem
in interface Chain
path
- the relative path to the new file system binding pointhandler
- the handlerpublic GroovyChain fileSystem(String path, Action<? super Chain> action) throws Exception
Chain
FileSystemBinding
for the given handler chain.fileSystem
in interface GroovyChain
fileSystem
in interface Chain
path
- the relative path to the new file system binding pointaction
- the definition of the handler chainException
- any thrown by action
public GroovyChain fileSystem(String path, @DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> handlers) throws Exception
GroovyChain
List
of Handler
from the given Closure
and adds a Handler
to this GroovyChain
that
changes the FileSystemBinding
for the Handler
list.
See GroovyChain.fileSystem(String, Handler)
for more details.
fileSystem
in interface GroovyChain
path
- the relative path
to the new file system binding pointhandlers
- the definition of the handler chainGroovyChain
Exception
- any exception thrown by the given closurepublic GroovyChain header(String headerName, String headerValue, Handler handler)
GroovyChain
header
in interface GroovyChain
header
in interface Chain
headerName
- the name of the HTTP Header to match onheaderValue
- the value of the HTTP Header to match onhandler
- the handler to delegate topublic GroovyChain header(String headerName, String headerValue, @DelegatesTo(value=GroovyContext.class,strategy=1) Closure<?> handler)
GroovyChain
Handler
to this GroovyChain
that delegates to the given Closure
as a Handler
if the request
has a HTTPHeader
with the given name and a it's value matches the given value exactly.
See GroovyChain.header(String, String, ratpack.handling.Handler)
for more details.
header
in interface GroovyChain
headerName
- the name of the HTTP Header to match onheaderValue
- the value of the HTTP Header to match onhandler
- the handler to delegate toGroovyChain
@Nullable public Registry getRegistry()
Chain
The registry that is available is dependent on how the GroovyChain
was constructed.
getRegistry
in interface Chain
null
if this has no registry.Handlers.chain(LaunchConfig, ratpack.registry.Registry, ratpack.func.Action)
public LaunchConfig getLaunchConfig()
Chain
getLaunchConfig
in interface Chain