public class LaunchConfigBuilder extends Object
LaunchConfig objects.
The following is the minimum requirement for creating a launch config…
import ratpack.launch.*;
import ratpack.handling.*;
LaunchConfig launchConfig = LaunchConfigBuilder.baseDir(new File("some/path")).build(
new HandlerFactory() {
public Handler create(LaunchConfig launchConfig) {
return new Handler() {
public void handle(Context context) {
context.getResponse().send("Hello World!");
}
};
}
}
);
baseDir(java.io.File)| Modifier and Type | Method and Description |
|---|---|
LaunchConfigBuilder |
address(InetAddress address)
Sets the address to bind to.
|
LaunchConfigBuilder |
backgroundExecutorService(ExecutorService executorService)
The executor service to use for blocking operations.
|
static LaunchConfigBuilder |
baseDir(File baseDir)
Create a new builder, using the given file as the base dir.
|
static LaunchConfigBuilder |
baseDir(Path baseDir)
Create a new builder, using the given file as the base dir.
|
LaunchConfigBuilder |
bufferAllocator(ByteBufAllocator byteBufAllocator)
The allocator to use when creating buffers in the application.
|
LaunchConfig |
build(HandlerFactory handlerFactory)
Builds the launch config, based on the current state and the handler factory.
|
LaunchConfigBuilder |
indexFiles(List<String> indexFiles)
Adds the given values as potential index file names.
|
LaunchConfigBuilder |
indexFiles(String... indexFiles)
Adds the given values as potential index file names.
|
LaunchConfigBuilder |
mainThreads(int mainThreads)
How many request handling threads to use.
|
LaunchConfigBuilder |
maxContentLength(int maxContentLength)
The max content length.
|
LaunchConfigBuilder |
other(Map<String,String> other)
Add some "other" properties.
|
LaunchConfigBuilder |
other(String key,
String value)
Add an "other" property.
|
LaunchConfigBuilder |
port(int port)
Sets the port to bind to.
|
LaunchConfigBuilder |
publicAddress(URI publicAddress)
The public address of the application.
|
LaunchConfigBuilder |
reloadable(boolean reloadable)
Whether or not the application is "reloadable".
|
LaunchConfigBuilder |
ssl(File keyStore,
String password)
A convenience method for configuring an SSL context using a password-protected keystore file.
|
LaunchConfigBuilder |
ssl(InputStream keyStore,
String password)
A convenience method for configuring an SSL context using a password-protected keystore file.
|
LaunchConfigBuilder |
ssl(URL keyStore,
String password)
A convenience method for configuring an SSL context using a password-protected keystore file.
|
LaunchConfigBuilder |
sslContext(SSLContext sslContext)
The SSL context to use if the application serves content over HTTPS.
|
public static LaunchConfigBuilder baseDir(File baseDir)
baseDir - The base dir of the launch configLaunchConfig.getBaseDir()public static LaunchConfigBuilder baseDir(Path baseDir)
baseDir - The base dir of the launch configLaunchConfig.getBaseDir()public LaunchConfigBuilder port(int port)
Default value is 5050.
port - The port to bind toLaunchConfig.getPort()public LaunchConfigBuilder address(InetAddress address)
Default value is null.
address - The address to bind toLaunchConfig.getAddress()public LaunchConfigBuilder reloadable(boolean reloadable)
Default value is false.
reloadable - Whether or not the application is "reloadable".LaunchConfig.isReloadable()public LaunchConfigBuilder mainThreads(int mainThreads)
Default value is 0.
mainThreads - The port to bind toLaunchConfig.getMainThreads()public LaunchConfigBuilder backgroundExecutorService(ExecutorService executorService)
Default value is Executors.newCachedThreadPool().
executorService - The executor service to use for blocking operationsLaunchConfig.getBackgroundExecutorService()public LaunchConfigBuilder bufferAllocator(ByteBufAllocator byteBufAllocator)
Default value is PooledByteBufAllocator.DEFAULT.
byteBufAllocator - The allocator to use when creating buffers in the applicationLaunchConfig.getBufferAllocator()public LaunchConfigBuilder publicAddress(URI publicAddress)
Default value is null.
publicAddress - The public address of the applicationLaunchConfig.getPublicAddress()public LaunchConfigBuilder maxContentLength(int maxContentLength)
maxContentLength - The max content length to accept.LaunchConfig.getMaxContentLength()public LaunchConfigBuilder indexFiles(String... indexFiles)
indexFiles - the potential index file names.LaunchConfig.getIndexFiles()public LaunchConfigBuilder indexFiles(List<String> indexFiles)
indexFiles - the potential index file names.LaunchConfig.getIndexFiles()public LaunchConfigBuilder sslContext(SSLContext sslContext)
sslContext - the SSL context.LaunchConfig.getSSLContext()public LaunchConfigBuilder ssl(InputStream keyStore, String password) throws GeneralSecurityException, IOException
GeneralSecurityExceptionIOExceptionSSLContexts.sslContext(java.io.InputStream, String),
LaunchConfig.getSSLContext()public LaunchConfigBuilder ssl(URL keyStore, String password) throws GeneralSecurityException, IOException
GeneralSecurityExceptionIOExceptionSSLContexts.sslContext(java.net.URL, String),
LaunchConfig.getSSLContext()public LaunchConfigBuilder ssl(File keyStore, String password) throws GeneralSecurityException, IOException
GeneralSecurityExceptionIOExceptionSSLContexts.sslContext(java.io.File, String),
LaunchConfig.getSSLContext()public LaunchConfigBuilder other(String key, String value)
key - The key of the propertyvalue - The value of the propertyLaunchConfig.getOther(String, String)public LaunchConfigBuilder other(Map<String,String> other)
other - A map of properties to add to the launch config other propertiesLaunchConfig.getOther(String, String)public LaunchConfig build(HandlerFactory handlerFactory)
handlerFactory - The handler factory for the application.LaunchConfig based on this builder's state