public interface GroovyRatpackServerSpec extends RatpackServerSpec
Modifier and Type | Method and Description |
---|---|
static GroovyRatpackServerSpec |
from(RatpackServerSpec spec) |
GroovyRatpackServerSpec |
handler(Function<? super Registry,? extends Handler> handlerFactory)
Sets the root handler to the return of the given function.
|
default GroovyRatpackServerSpec |
handlers(Closure<?> handlers) |
GroovyRatpackServerSpec |
registry(Function<? super Registry,? extends Registry> function)
Sets the user registry as the return value of the given function.
|
default GroovyRatpackServerSpec |
registryOf(Closure<?> action) |
GroovyRatpackServerSpec |
serverConfig(Action<? super ServerConfigBuilder> action) |
default GroovyRatpackServerSpec |
serverConfig(Closure<?> action) |
GroovyRatpackServerSpec |
serverConfig(ServerConfig serverConfig)
Sets the server configuration for the application.
|
handler, handlers, registry, registryOf, serverConfig
static GroovyRatpackServerSpec from(RatpackServerSpec spec)
default GroovyRatpackServerSpec handlers(@DelegatesTo(value=GroovyChain.class,strategy=1) Closure<?> handlers)
GroovyRatpackServerSpec handler(Function<? super Registry,? extends Handler> handlerFactory)
RatpackServerSpec
The given function receives the effective server registry.
This is the base registry (common Ratpack infrastructure) joined
with the user registry (i.e. the registry set on this spec).
All requests will be routed to the given handler.
Generally, it is more convenient to use the RatpackServerSpec.handlers(Action)
method than this as it makes it easy to build a handler chain.
The Handlers
type provides handler implementations that may be of use.
If a handler is not set, the handler returned by Handlers.notFound()
will be used (i.e. all requests will result in a 404).
handler
in interface RatpackServerSpec
handlerFactory
- a factory for the root handlerthis
Handlers
,
RatpackServerSpec.handlers(Action)
GroovyRatpackServerSpec registry(Function<? super Registry,? extends Registry> function)
RatpackServerSpec
The given function receives the “base” registry (i.e. the base infrastructure provided by Ratpack) as its argument.
If a user registry is not set, an empty registry
will be used.
registry
in interface RatpackServerSpec
function
- a function that provides the user registrythis
GroovyRatpackServerSpec serverConfig(ServerConfig serverConfig)
RatpackServerSpec
Server configs can be created via ServerConfig.builder()
.
serverConfig
in interface RatpackServerSpec
serverConfig
- the server configurationthis
GroovyRatpackServerSpec serverConfig(Action<? super ServerConfigBuilder> action) throws Exception
serverConfig
in interface RatpackServerSpec
Exception
default GroovyRatpackServerSpec serverConfig(@DelegatesTo(value=ServerConfigBuilder.class,strategy=1) Closure<?> action) throws Exception
Exception
default GroovyRatpackServerSpec registryOf(@DelegatesTo(value=RegistrySpec.class,strategy=1) Closure<?> action) throws Exception
Exception