Interface ServerConfigBuilder
-
- All Superinterfaces:
ConfigDataBuilder
public interface ServerConfigBuilder extends ConfigDataBuilder
Builds aServerConfig
.
-
-
Field Summary
-
Fields inherited from interface ratpack.config.ConfigDataBuilder
DEFAULT_ENV_PREFIX, DEFAULT_PROP_PREFIX
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ServerConfigBuilder
add(ConfigSource configSource)
Adds a configuration source.ServerConfigBuilder
address(InetAddress address)
Sets the address to bind to.ServerConfigBuilder
args(String[] args)
Adds the given args as a config source.ServerConfigBuilder
args(String separator, String[] args)
Invokesargs(String, String, String[])
, with no prefix.ServerConfigBuilder
args(String prefix, String separator, String[] args)
Adds a configuration source for the given string args.default ServerConfigBuilder
baseDir(File file)
ServerConfigBuilder
baseDir(Path baseDir)
Sets the root of the filesystem for the application.ServerConfig
build()
Builds the server config.ServerConfigBuilder
configureObjectMapper(Action<ObjectMapper> action)
Configures the object mapper used for binding configuration data to arbitrary objects.ServerConfigBuilder
connectQueueSize(int connectQueueSize)
The maximum amount of connections that may be waiting to be accepted at any time.ServerConfigBuilder
connectTimeoutMillis(int connectTimeoutMillis)
The connect timeout of the channel.ServerConfigBuilder
decodingErrorLevel(DecodingErrorLevel log)
Configures how to emit messages associated with errors when decoding incoming requests.ServerConfigBuilder
development(boolean development)
Whether or not the application is "development".ServerConfigBuilder
env()
Adds a configuration source for environment variables starting with the prefix "RATPACK_".ServerConfigBuilder
env(String prefix)
Adds a configuration source for environment variables starting with the specified prefix.ServerConfigBuilder
env(String prefix, Function<String,String> mapFunc)
Adds a configuration source for environment variables starting with the specified prefix.ServerConfigBuilder
env(EnvironmentParser environmentParser)
Adds a configuration source for environment variables using custom parsing logic.default ServerConfigBuilder
findBaseDir()
Sets the base dir usingBaseDir.find()
.default ServerConfigBuilder
findBaseDir(String markerFilePath)
Sets the base dir usingBaseDir.find(String)
.ServerConfigBuilder
idleTimeout(Duration idleTimeout)
The default read timeout of the channel.ServerConfigBuilder
json(com.google.common.io.ByteSource byteSource)
Adds a configuration source for a JSON file.ServerConfigBuilder
json(String path)
Adds the JSON file at the given path as a configuration source.ServerConfigBuilder
json(URL url)
Adds a configuration source for a JSON file.ServerConfigBuilder
json(Path path)
Adds a configuration source for a JSON file.ServerConfigBuilder
maxChunkSize(int maxChunkSize)
The maximum size of read chunks of request/response bodies.ServerConfigBuilder
maxContentLength(int maxContentLength)
The max number of bytes a request body can be.ServerConfigBuilder
maxHeaderSize(int maxHeaderSize)
The maximum size of all headers allowed for reading http requests.ServerConfigBuilder
maxInitialLineLength(int maxInitialLineLength)
The maximum initial line length allowed for reading http requests.ServerConfigBuilder
maxMessagesPerRead(int maxMessagesPerRead)
The maximum number of messages to read per read loop.ServerConfigBuilder
object(String path, Object object)
Adds the object's fields at the given path as a configuration source.ServerConfigBuilder
onError(Action<? super Throwable> errorHandler)
Sets the error all that will be used for added configuration sources.ServerConfigBuilder
port(int port)
Sets the port to listen for requests on.ServerConfigBuilder
portFile(Path portFile)
The path where to store the bind port.ServerConfigBuilder
props(com.google.common.io.ByteSource byteSource)
Adds a configuration source for a properties file.ServerConfigBuilder
props(String path)
Adds the properties file at the given path as a configuration source.ServerConfigBuilder
props(URL url)
Adds a configuration source for a properties file.ServerConfigBuilder
props(Path path)
Adds a configuration source for a properties file.ServerConfigBuilder
props(Map<String,String> map)
Adds a configuration source for a Map (flat key-value pairs).ServerConfigBuilder
props(Properties properties)
Adds a configuration source for a properties object.ServerConfigBuilder
publicAddress(URI publicAddress)
The public address of the application.ServerConfigBuilder
receiveBufferSize(int receiveBufferSize)
The StandardSocketOptions.SO_RCVBUF option.ServerConfigBuilder
registerShutdownHook(boolean registerShutdownHook)
Whether or not to register a JVM shutdown hook to gracefully stop the server.ServerConfigBuilder
require(String pointer, com.google.common.reflect.TypeToken<?> type)
Declares that it is required that the server config provide an object of the given type at the given path.default ServerConfigBuilder
require(String pointer, Class<?> type)
Declares that it is required that the server config provide an object of the given type at the given path.default ServerConfigBuilder
require(String pointer, Type type)
Declares that it is required that the server config provide an object of the given type at the given path.ServerConfigBuilder
ssl(io.netty.handler.ssl.SslContext sslContext)
The SSL context to use if the application serves content over HTTPS.ServerConfigBuilder
ssl(io.netty.handler.ssl.SslContext sslContext, Action<? super io.netty.util.DomainWildcardMappingBuilder<io.netty.handler.ssl.SslContext>> sniConfiguration)
Configures the SSL contexts to use based on the client requested domain if the application serves content over HTTPS.ServerConfigBuilder
ssl(io.netty.util.Mapping<String,io.netty.handler.ssl.SslContext> sniConfiguration)
Configures the SSL contexts to use based on the client requested domain if the application serves content over HTTPS.ServerConfigBuilder
sysProps()
Adds a configuration source for system properties starting with the prefix "ratpack.".ServerConfigBuilder
sysProps(String prefix)
Adds a configuration source for system properties starting with the specified prefix.ServerConfigBuilder
threads(int threads)
The number of threads to use.ServerConfigBuilder
writeSpinCount(int writeSpinCount)
The maximum loop count for a write operation until WritableByteChannel.write(ByteBuffer) returns a non-zero value.ServerConfigBuilder
yaml(com.google.common.io.ByteSource byteSource)
Adds a configuration source for a YAML file.ServerConfigBuilder
yaml(String path)
Adds the YAML file at the given path as a configuration source.ServerConfigBuilder
yaml(URL url)
Adds a configuration source for a YAML file.ServerConfigBuilder
yaml(Path path)
Adds a configuration source for a YAML file.-
Methods inherited from interface ratpack.config.ConfigDataBuilder
getConfigSources, getObjectMapper, jacksonModules
-
-
-
-
Method Detail
-
baseDir
ServerConfigBuilder baseDir(Path baseDir)
Sets the root of the filesystem for the application.The
base dir
acts as the portable file system for the application. All paths within the application, resolved by Ratpack API are resolved from this point. For example,Chain.files(Action)
allows serving static files within the base dir.The base dir is also used to resolve paths to file system locations when using
json(String)
,yaml(String)
andprops(String)
. This allows config files to travel with the application within the base dir.It is generally desirable to use the
BaseDir.find()
to dynamically find the base dir at runtime.- Parameters:
baseDir
- the base dir- Returns:
this
-
baseDir
default ServerConfigBuilder baseDir(File file)
- Parameters:
file
- the base dir- Returns:
this
-
findBaseDir
default ServerConfigBuilder findBaseDir()
Sets the base dir usingBaseDir.find()
.- Returns:
this
- Since:
- 1.4
-
findBaseDir
default ServerConfigBuilder findBaseDir(String markerFilePath)
Sets the base dir usingBaseDir.find(String)
.- Parameters:
markerFilePath
- the path to the marker file on the classpath- Returns:
this
- Since:
- 1.4
-
port
ServerConfigBuilder port(int port)
Sets the port to listen for requests on.Defaults to 5050.
- Parameters:
port
- the port to listen for requests on- Returns:
this
- See Also:
ServerConfig.getPort()
-
address
ServerConfigBuilder address(InetAddress address)
Sets the address to bind to.Default value is
null
.- Parameters:
address
- The address to bind to- Returns:
this
- See Also:
ServerConfig.getAddress()
-
development
ServerConfigBuilder development(boolean development)
Whether or not the application is "development".Default value is
false
.- Parameters:
development
- Whether or not the application is "development".- Returns:
this
- See Also:
ServerConfig.isDevelopment()
-
threads
ServerConfigBuilder threads(int threads)
The number of threads to use.Defaults to
ServerConfig.DEFAULT_THREADS
- Parameters:
threads
- the size of the event loop thread pool- Returns:
this
- See Also:
ServerConfig.getThreads()
-
registerShutdownHook
ServerConfigBuilder registerShutdownHook(boolean registerShutdownHook)
Whether or not to register a JVM shutdown hook to gracefully stop the server.Default value is
true
.- Parameters:
registerShutdownHook
- whether to register or not- Returns:
this
- Since:
- 1.6
- See Also:
ServerConfig.isRegisterShutdownHook()
-
publicAddress
ServerConfigBuilder publicAddress(URI publicAddress)
The public address of the application.Default value is
null
.- Parameters:
publicAddress
- the public address of the application- Returns:
this
- See Also:
ServerConfig.getPublicAddress()
-
maxContentLength
ServerConfigBuilder maxContentLength(int maxContentLength)
The max number of bytes a request body can be. Default value is1048576
(1 megabyte).- Parameters:
maxContentLength
- the max content length to accept- Returns:
this
- See Also:
ServerConfig.getMaxContentLength()
-
maxChunkSize
ServerConfigBuilder maxChunkSize(int maxChunkSize)
The maximum size of read chunks of request/response bodies. Default value isServerConfig.DEFAULT_MAX_CHUNK_SIZE
.- Parameters:
maxChunkSize
- the maximum size of read chunks of request/response bodies- Returns:
this
- See Also:
ServerConfig.getMaxChunkSize()
-
maxInitialLineLength
ServerConfigBuilder maxInitialLineLength(int maxInitialLineLength)
The maximum initial line length allowed for reading http requests. Default value isServerConfig.DEFAULT_MAX_INITIAL_LINE_LENGTH
.- Parameters:
maxInitialLineLength
- the maximum length of the initial line of the request.- Returns:
this
- Since:
- 1.4
- See Also:
ServerConfig.getMaxInitialLineLength()
-
maxHeaderSize
ServerConfigBuilder maxHeaderSize(int maxHeaderSize)
The maximum size of all headers allowed for reading http requests. Default value isServerConfig.DEFAULT_MAX_HEADER_SIZE
.- Parameters:
maxHeaderSize
- the maximum size of the sum of the length of all headers.- Returns:
this
- Since:
- 1.4
- See Also:
ServerConfig.getMaxHeaderSize()
-
connectTimeoutMillis
ServerConfigBuilder connectTimeoutMillis(int connectTimeoutMillis)
The connect timeout of the channel.- Parameters:
connectTimeoutMillis
- the connect timeout in milliseconds- Returns:
this
- See Also:
ServerConfig.getConnectTimeoutMillis()
-
idleTimeout
ServerConfigBuilder idleTimeout(Duration idleTimeout)
The default read timeout of the channel.- Parameters:
idleTimeout
- the idleTimeout (Duration.ZERO
= no timeout, must not be negative, must not be null)- Returns:
this
- Since:
- 1.5
- See Also:
ServerConfig.getIdleTimeout()
-
maxMessagesPerRead
ServerConfigBuilder maxMessagesPerRead(int maxMessagesPerRead)
The maximum number of messages to read per read loop.- Parameters:
maxMessagesPerRead
- the max messages per read- Returns:
this
- See Also:
ServerConfig.getMaxMessagesPerRead()
-
receiveBufferSize
ServerConfigBuilder receiveBufferSize(int receiveBufferSize)
The StandardSocketOptions.SO_RCVBUF option.- Parameters:
receiveBufferSize
- the recieve buffer size- Returns:
this
- See Also:
ServerConfig.getReceiveBufferSize()
-
connectQueueSize
ServerConfigBuilder connectQueueSize(int connectQueueSize)
The maximum amount of connections that may be waiting to be accepted at any time.This is effectively the
SO_BACKLOG
standard socket parameter. If the queue is full (i.e. there are too many pending connections), connection attempts will be rejected. Established connections are not part of this queue so do not contribute towards the limit.The default value is platform specific, but usually either 200 or 128. Most application do not need to change this default.
- Parameters:
connectQueueSize
- connection queue size- Since:
- 1.5
-
writeSpinCount
ServerConfigBuilder writeSpinCount(int writeSpinCount)
The maximum loop count for a write operation until WritableByteChannel.write(ByteBuffer) returns a non-zero value.- Parameters:
writeSpinCount
- the write spin count- Returns:
this
- See Also:
ServerConfig.getWriteSpinCount()
-
portFile
ServerConfigBuilder portFile(Path portFile)
The path where to store the bind port.- Parameters:
portFile
- the path file- Returns:
this
- Since:
- 1.8
- See Also:
ServerConfig.getPortFile()
-
ssl
ServerConfigBuilder ssl(io.netty.handler.ssl.SslContext sslContext)
The SSL context to use if the application serves content over HTTPS.- Parameters:
sslContext
- the SSL context- Returns:
this
- Since:
- 1.5
- See Also:
SslContextBuilder
-
ssl
ServerConfigBuilder ssl(io.netty.handler.ssl.SslContext sslContext, Action<? super io.netty.util.DomainWildcardMappingBuilder<io.netty.handler.ssl.SslContext>> sniConfiguration)
Configures the SSL contexts to use based on the client requested domain if the application serves content over HTTPS.Specifying this configuration will override the SSL context configured via
ssl(SslContext)
.Domain mapping supports DNS Wildcard and will match at most one level deep.
- Parameters:
sslContext
- the default SSL context to use if no domain mapping is found.sniConfiguration
- the SNI based SSL configuration to apply.- Returns:
this
- Since:
- 2.0
-
ssl
ServerConfigBuilder ssl(io.netty.util.Mapping<String,io.netty.handler.ssl.SslContext> sniConfiguration)
Configures the SSL contexts to use based on the client requested domain if the application serves content over HTTPS.Specifying this configuration will override the SSL context configured via
ssl(SslContext)
.Domain mapping supports DNS Wildcard and will match at most one level deep.
- Parameters:
sniConfiguration
- the SNI based SSL configuration to apply.- Returns:
this
- Since:
- 2.0
- See Also:
DomainWildcardMappingBuilder
-
env
ServerConfigBuilder env()
Adds a configuration source for environment variables starting with the prefix "RATPACK_".The prefix will be removed before loading the data. The environment variable name is split into per-object segments using double underscore as an object boundary. Segments are transformed into camel-case field names using a single underscore as a word boundary.
- Specified by:
env
in interfaceConfigDataBuilder
- Returns:
- this
-
env
ServerConfigBuilder env(String prefix)
Adds a configuration source for environment variables starting with the specified prefix. The prefix will be removed before loading the data. The environment variable name is split into per-object segments using double underscore as an object boundary. Segments are transformed into camel-case field names using a single underscore as a word boundary.- Specified by:
env
in interfaceConfigDataBuilder
- Parameters:
prefix
- the prefix which should be used to identify relevant environment variables- Returns:
- this
-
args
ServerConfigBuilder args(String[] args)
Adds the given args as a config source.This method is designed to be used with the args var of the
static main(String... args)
application entry point. This allows configuration parameters to be passed to the application on the command line.Each arg should be of the format
«key»=«value»
. For the following example, the application has been started with the argumentthing.name=foo
.import ratpack.test.embed.EmbeddedApp; import static org.junit.jupiter.api.Assertions.assertEquals; public class Example { static class Thing { public String name; } public static void main(String... args) throws Exception { EmbeddedApp.of(a -> a .serverConfig(s -> s .args(args) .require("/thing", Thing.class) ) .handlers(c -> c .get(ctx -> ctx.render(ctx.get(Thing.class).name)) ) ).test(httpClient -> assertEquals(httpClient.getText(), "foo") ); } }
- Specified by:
args
in interfaceConfigDataBuilder
- Parameters:
args
- the argument values- Returns:
this
- Since:
- 1.1
-
args
ServerConfigBuilder args(String separator, String[] args)
Invokesargs(String, String, String[])
, with no prefix.- Specified by:
args
in interfaceConfigDataBuilder
- Parameters:
separator
- the separator of the key and value in each argargs
- the argument values- Returns:
this
- Since:
- 1.1
- See Also:
args(String[])
-
args
ServerConfigBuilder args(String prefix, String separator, String[] args)
Adds a configuration source for the given string args.Args that do not start with the given
prefix
are ignored. The remaining are each split using the givenseparator
(as a literal string, not as a regex), then trimmed of the prefix.- Specified by:
args
in interfaceConfigDataBuilder
- Parameters:
prefix
- the prefix that each arg must have to be considered (usenull
or""
for no prefix)separator
- the separator between the key and the valueargs
- the argument values- Returns:
this
- Since:
- 1.1
- See Also:
args(String[])
-
props
ServerConfigBuilder props(com.google.common.io.ByteSource byteSource)
Adds a configuration source for a properties file.- Specified by:
props
in interfaceConfigDataBuilder
- Parameters:
byteSource
- the source of the properties data- Returns:
this
-
props
ServerConfigBuilder props(String path)
Adds the properties file at the given path as a configuration source.If a base dir is set, the path will be resolved relative to it. Otherwise, it will be resolved relative to the file system root.
- Specified by:
props
in interfaceConfigDataBuilder
- Parameters:
path
- the path to the file- Returns:
this
-
props
ServerConfigBuilder props(Path path)
Adds a configuration source for a properties file.- Specified by:
props
in interfaceConfigDataBuilder
- Parameters:
path
- the source of the properties data- Returns:
this
-
props
ServerConfigBuilder props(Properties properties)
Adds a configuration source for a properties object.- Specified by:
props
in interfaceConfigDataBuilder
- Parameters:
properties
- the properties object- Returns:
this
-
object
ServerConfigBuilder object(String path, Object object)
Adds the object's fields at the given path as a configuration source.The path is a period separated key string. The given object is subject to value merging and overrides as per other config sources.
import ratpack.config.ConfigData; import java.util.Collections; import static org.junit.jupiter.api.Assertions.assertEquals; public class Example { static class Thing { public String f1; public String f2; public String f3; } public static void main(String... args) throws Exception { Thing input = new Thing(); input.f1 = "1"; input.f2 = "2"; ConfigData configData = ConfigData.of(c -> c .object("thing", input) .props(Collections.singletonMap("thing.f1", "changed")) .object("thing.f3", "changed") ); Thing thing = configData.get("/thing", Thing.class); assertEquals("changed", thing.f1); assertEquals("2", thing.f2); assertEquals("changed", thing.f3); } }
- Specified by:
object
in interfaceConfigDataBuilder
- Parameters:
path
- the configuration path the object's fields should be mapped on toobject
- the object from which to derive the configuration fields- Returns:
this
- Since:
- 1.4
-
props
ServerConfigBuilder props(Map<String,String> map)
Adds a configuration source for a Map (flat key-value pairs). This signature is particularly useful for providing default values as shown below:import com.google.common.collect.ImmutableMap; import ratpack.config.ConfigData; import ratpack.core.server.ServerConfig; import static org.junit.jupiter.api.Assertions.*; public class Example { public static void main(String[] args) throws Exception { ServerConfig serverConfig = ServerConfig .builder() .props(ImmutableMap.of("server.port", "5060")) .sysProps() .build(); assertEquals(5060, serverConfig.getPort()); } }
- Specified by:
props
in interfaceConfigDataBuilder
- Parameters:
map
- the map- Returns:
this
-
props
ServerConfigBuilder props(URL url)
Adds a configuration source for a properties file.- Specified by:
props
in interfaceConfigDataBuilder
- Parameters:
url
- the source of the properties data- Returns:
this
-
sysProps
ServerConfigBuilder sysProps()
Adds a configuration source for system properties starting with the prefix "ratpack.".- Specified by:
sysProps
in interfaceConfigDataBuilder
- Returns:
this
-
sysProps
ServerConfigBuilder sysProps(String prefix)
Adds a configuration source for system properties starting with the specified prefix.- Specified by:
sysProps
in interfaceConfigDataBuilder
- Parameters:
prefix
- the prefix which should be used to identify relevant system properties; the prefix will be removed before loading the data- Returns:
this
-
onError
ServerConfigBuilder onError(Action<? super Throwable> errorHandler)
Sets the error all that will be used for added configuration sources. The error all only applies to configuration sources added after this method is called; it is not applied retroactively.- Specified by:
onError
in interfaceConfigDataBuilder
- Parameters:
errorHandler
- the error all- Returns:
this
- See Also:
Action.noop()
,Action.throwException()
-
configureObjectMapper
ServerConfigBuilder configureObjectMapper(Action<ObjectMapper> action)
Configures the object mapper used for binding configuration data to arbitrary objects.- Specified by:
configureObjectMapper
in interfaceConfigDataBuilder
- Parameters:
action
- an action to perform upon the object mapper- Returns:
this
-
add
ServerConfigBuilder add(ConfigSource configSource)
Adds a configuration source.- Specified by:
add
in interfaceConfigDataBuilder
- Parameters:
configSource
- the configuration source to add- Returns:
this
-
env
ServerConfigBuilder env(String prefix, Function<String,String> mapFunc)
Adds a configuration source for environment variables starting with the specified prefix. The prefix will be removed before loading the data. The environment variable name is split into per-object segments using double underscore as an object boundary. Segments are transformed into field names using the specified transformation function rather than the default function.- Specified by:
env
in interfaceConfigDataBuilder
- Parameters:
prefix
- the prefix which should be used to identify relevant environment variablesmapFunc
- the function to transform segments into field names- Returns:
- this
-
env
ServerConfigBuilder env(EnvironmentParser environmentParser)
Adds a configuration source for environment variables using custom parsing logic.- Specified by:
env
in interfaceConfigDataBuilder
- Parameters:
environmentParser
- the parser to use to interpret environment variables- Returns:
this
-
json
ServerConfigBuilder json(com.google.common.io.ByteSource byteSource)
Adds a configuration source for a JSON file.- Specified by:
json
in interfaceConfigDataBuilder
- Parameters:
byteSource
- the source of the JSON data- Returns:
this
-
json
ServerConfigBuilder json(Path path)
Adds a configuration source for a JSON file.- Specified by:
json
in interfaceConfigDataBuilder
- Parameters:
path
- the source of the JSON data- Returns:
this
-
json
ServerConfigBuilder json(String path)
Adds the JSON file at the given path as a configuration source.If a base dir is set, the path will be resolved relative to it. Otherwise, it will be resolved relative to the file system root.
- Specified by:
json
in interfaceConfigDataBuilder
- Parameters:
path
- the path to the file- Returns:
this
-
json
ServerConfigBuilder json(URL url)
Adds a configuration source for a JSON file.- Specified by:
json
in interfaceConfigDataBuilder
- Parameters:
url
- the source of the JSON data- Returns:
this
-
yaml
ServerConfigBuilder yaml(com.google.common.io.ByteSource byteSource)
Adds a configuration source for a YAML file.- Specified by:
yaml
in interfaceConfigDataBuilder
- Parameters:
byteSource
- the source of the YAML data- Returns:
this
-
yaml
ServerConfigBuilder yaml(Path path)
Adds a configuration source for a YAML file.- Specified by:
yaml
in interfaceConfigDataBuilder
- Parameters:
path
- the source of the YAML data- Returns:
this
-
yaml
ServerConfigBuilder yaml(String path)
Adds the YAML file at the given path as a configuration source.If a base dir is set, the path will be resolved relative to it. Otherwise, it will be resolved relative to the file system root.
- Specified by:
yaml
in interfaceConfigDataBuilder
- Parameters:
path
- the path to the file- Returns:
this
-
yaml
ServerConfigBuilder yaml(URL url)
Adds a configuration source for a YAML file.- Specified by:
yaml
in interfaceConfigDataBuilder
- Parameters:
url
- the source of the YAML data- Returns:
this
-
require
default ServerConfigBuilder require(String pointer, Class<?> type)
Declares that it is required that the server config provide an object of the given type at the given path.The
build()
method will fail if the config is not able to provide the requested object.All objects declared using this method will also automatically be implicitly added to the base registry.
The
pointer
argument is of the same format given to theConfigData.get(String, Class)
method.import ratpack.test.embed.EmbeddedApp; import java.util.Collections; import static org.junit.jupiter.api.Assertions.*; public class Example { static class MyConfig { public String value; } public static void main(String... args) throws Exception { EmbeddedApp.of(a -> a .serverConfig(s -> s .props(Collections.singletonMap("config.value", "foo")) .require("/config", MyConfig.class) ) .handlers(c -> c .get(ctx -> ctx.render(ctx.get(MyConfig.class).value)) ) ).test(httpClient -> assertEquals("foo", httpClient.getText()) ); } }
- Parameters:
pointer
- a JSON Pointer specifying the point in the configuration data to bind fromtype
- the class of the type to bind to- Returns:
this
-
require
default ServerConfigBuilder require(String pointer, Type type)
Declares that it is required that the server config provide an object of the given type at the given path.- Parameters:
pointer
- a JSON Pointer specifying the point in the configuration data to bind fromtype
- the type to bind to- Returns:
this
- Since:
- 1.4
-
require
ServerConfigBuilder require(String pointer, com.google.common.reflect.TypeToken<?> type)
Declares that it is required that the server config provide an object of the given type at the given path.- Parameters:
pointer
- a JSON Pointer specifying the point in the configuration data to bind fromtype
- the type to bind to- Returns:
this
- Since:
- 1.4
-
build
ServerConfig build()
Builds the server config.- Specified by:
build
in interfaceConfigDataBuilder
- Returns:
- a server config
- See Also:
ServerConfigImposition
-
decodingErrorLevel
ServerConfigBuilder decodingErrorLevel(DecodingErrorLevel log)
Configures how to emit messages associated with errors when decoding incoming requests.- Parameters:
log
- the logging setting for failed decodings- Returns:
this
- Since:
- 2.0
- See Also:
()
-
-