Package com.blackrook.small.jetty
Class DefaultSmallJettyConfiguration
java.lang.Object
com.blackrook.small.jetty.DefaultSmallJettyConfiguration
- All Implemented Interfaces:
SmallJettyConfiguration
,com.blackrook.small.SmallConfiguration
public class DefaultSmallJettyConfiguration extends Object implements SmallJettyConfiguration
Configuration builder for the Jetty bootstrap.
Defaults:
- serverPort: 8080
- secureServerPort: null
- contextPath: "/"
- tempPath: null
- servletPaths: ["/*"]
- applicationPackageRoots: [ ]
- allowOptions: false
- allowTrace: false
- allowWebSockets: true
- autoParseMultipart: true
- attributes: NONE
- maxThreads: 20
- idleConnectionTimeout: 30000
- headerCacheSize: 8192
- outputBufferSize: 32768
- requestHeaderSize: 8192
- responseHeaderSize: 8192
- sendServerVersion: false
- sendDateHeader: false
- sendXPoweredBy: false
- servletContextOptions: 0
- sslConfiguration: null
- gzipConfiguration: null
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultSmallJettyConfiguration.GZipConfigurationBuilder
static class
DefaultSmallJettyConfiguration.SSLConfigurationBuilder
Nested classes/interfaces inherited from interface com.blackrook.small.jetty.SmallJettyConfiguration
SmallJettyConfiguration.GZipConfiguration, SmallJettyConfiguration.SSLConfiguration
-
Method Summary
-
Method Details
-
configure
- Returns:
- a new configuration builder.
-
getServerPort
public int getServerPort()- Specified by:
getServerPort
in interfacecom.blackrook.small.SmallConfiguration
-
getSecureServerPort
- Specified by:
getSecureServerPort
in interfacecom.blackrook.small.SmallConfiguration
-
getContextPath
- Specified by:
getContextPath
in interfacecom.blackrook.small.SmallConfiguration
-
getTempPath
- Specified by:
getTempPath
in interfacecom.blackrook.small.SmallConfiguration
-
getServletPaths
- Specified by:
getServletPaths
in interfacecom.blackrook.small.SmallConfiguration
-
getApplicationPackageRoots
- Specified by:
getApplicationPackageRoots
in interfacecom.blackrook.small.SmallConfiguration
-
allowOptions
public boolean allowOptions()- Specified by:
allowOptions
in interfacecom.blackrook.small.SmallConfiguration
-
allowTrace
public boolean allowTrace()- Specified by:
allowTrace
in interfacecom.blackrook.small.SmallConfiguration
-
allowWebSockets
public boolean allowWebSockets()- Specified by:
allowWebSockets
in interfacecom.blackrook.small.SmallConfiguration
-
autoParseMultipart
public boolean autoParseMultipart()- Specified by:
autoParseMultipart
in interfacecom.blackrook.small.SmallConfiguration
-
getMaxThreads
public int getMaxThreads()- Specified by:
getMaxThreads
in interfaceSmallJettyConfiguration
- Returns:
- the maximum amount of connector threads.
-
getIdleConnectionTimeout
public int getIdleConnectionTimeout()- Specified by:
getIdleConnectionTimeout
in interfaceSmallJettyConfiguration
- Returns:
- the amount of time in milliseconds before an open HTTP connection times out.
-
getHeaderCacheSize
public int getHeaderCacheSize()- Specified by:
getHeaderCacheSize
in interfaceSmallJettyConfiguration
- Returns:
- the header cache size in bytes.
-
getOutputBufferSize
public int getOutputBufferSize()- Specified by:
getOutputBufferSize
in interfaceSmallJettyConfiguration
- Returns:
- the output buffer cache size in bytes.
-
getRequestHeaderSize
public int getRequestHeaderSize()- Specified by:
getRequestHeaderSize
in interfaceSmallJettyConfiguration
- Returns:
- the request header cache size in bytes.
-
getResponseHeaderSize
public int getResponseHeaderSize()- Specified by:
getResponseHeaderSize
in interfaceSmallJettyConfiguration
- Returns:
- the response header cache size in bytes.
-
getSendServerVersion
public boolean getSendServerVersion()- Specified by:
getSendServerVersion
in interfaceSmallJettyConfiguration
- Returns:
- true if the server version should be sent in headers/default pages, false if not.
-
getSendDateHeader
public boolean getSendDateHeader()- Specified by:
getSendDateHeader
in interfaceSmallJettyConfiguration
- Returns:
- true if the server date should be sent in headers/default pages, false if not.
-
getSendXPoweredBy
public boolean getSendXPoweredBy()- Specified by:
getSendXPoweredBy
in interfaceSmallJettyConfiguration
- Returns:
- true if the server name should be sent in headers/default pages, false if not.
-
getServletContextOptions
public int getServletContextOptions()- Specified by:
getServletContextOptions
in interfaceSmallJettyConfiguration
- Returns:
- the Jetty options to pass to the servlet context handler.
- See Also:
ServletContextHandler.SESSIONS
,ServletContextHandler.SECURITY
,ServletContextHandler.GZIP
-
getSSLConfiguration
- Specified by:
getSSLConfiguration
in interfaceSmallJettyConfiguration
- Returns:
- the SSL configuration to use for SSL, or null for no secure socket setup.
-
getGZipCompression
- Specified by:
getGZipCompression
in interfaceSmallJettyConfiguration
- Returns:
- the GZip configuration to use, or null for no compression scheme.
-
getAttribute
- Specified by:
getAttribute
in interfacecom.blackrook.small.SmallConfiguration
-
setServerPort
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getServerPort()
-
setSecureServerPort
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getSecureServerPort()
-
setContextPath
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getContextPath()
-
setTempPath
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getTempPath()
-
setServletPaths
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getServletPaths()
-
setApplicationPackageRoots
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getApplicationPackageRoots()
-
setAllowOptions
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
allowOptions()
-
setAllowTrace
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
allowTrace()
-
setAllowWebSockets
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
allowWebSockets()
-
setAutoParseMultipart
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
autoParseMultipart()
-
setMaxThreads
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getMaxThreads()
-
setIdleConnectionTimeout
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getIdleConnectionTimeout()
-
setHeaderCacheSize
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getHeaderCacheSize()
-
setOutputBufferSize
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getOutputBufferSize()
-
setRequestHeaderSize
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getRequestHeaderSize()
-
setResponseHeaderSize
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getResponseHeaderSize()
-
setSendServerVersion
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getSendServerVersion()
-
setSendDateHeader
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getSendDateHeader()
-
setSendXPoweredBy
- Parameters:
value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
getSendXPoweredBy()
-
setAttribute
- Parameters:
attributeName
- the attribute name.value
- the value to set.- Returns:
- this builder, for chaining.
- See Also:
SmallConfiguration.getAttribute(String)
,getAttribute(String, Object)
-
useSSL
public DefaultSmallJettyConfiguration useSSL(int port, String keyStorePath, String keyStorePassword)Sets the HTTPS port and the keystore/truststore file and password. Assumes that the store is in JKS format.- Parameters:
port
- the secure HTTP server port.keyStorePath
- the keystore/truststore path.keyStorePassword
- the keystore/truststore password.- Returns:
- this builder, for chaining.
- See Also:
setSecureServerPort(Integer)
-
useSSL
public DefaultSmallJettyConfiguration useSSL(int port, String keyStoreType, String keyStorePath, String keyStorePassword)Sets the HTTPS port and the keystore/truststore file and password.- Parameters:
port
- the secure HTTP server port.keyStoreType
- the keystore/truststore type.keyStorePath
- the keystore/truststore path.keyStorePassword
- the keystore/truststore password.- Returns:
- this builder, for chaining.
- See Also:
setSecureServerPort(Integer)
-
useSSL
public DefaultSmallJettyConfiguration useSSL(int port, String keyStorePath, String keyStorePassword, String trustStorePath, String trustStorePassword)Sets the HTTPS port and the keystore/truststore file and password.- Parameters:
port
- the secure HTTP server port.keyStorePath
- the keystore path.keyStorePassword
- the keystore password.trustStorePath
- the truststore path.trustStorePassword
- the truststore password.- Returns:
- this builder, for chaining.
- See Also:
setSecureServerPort(Integer)
-
useSSL
public DefaultSmallJettyConfiguration useSSL(int port, String keyStoreType, String keyStorePath, String keyStorePassword, String trustStoreType, String trustStorePath, String trustStorePassword)Sets the HTTPS port and the keystore/truststore file and password.- Parameters:
port
- the secure HTTP server port.keyStoreType
- the keystore type.keyStorePath
- the keystore path.keyStorePassword
- the keystore password.trustStoreType
- the truststore type.trustStorePath
- the truststore path.trustStorePassword
- the truststore password.- Returns:
- this builder, for chaining.
- See Also:
setSecureServerPort(Integer)
-
setGZip
Sets the GZip handler configuration for this application.- Parameters:
gzip
- the GZip configuration.- Returns:
- this builder, for chaining.
-