Interface SeBootstrap.Configuration
-
- Enclosing interface:
- SeBootstrap
public static interface SeBootstrap.Configuration
Provides information needed by the JAX-RS implementation for bootstrapping an application.The configuration essentially consists of a set of parameters. While the set of actually effective keys is product specific, the key constants defined by the
SeBootstrap.Configuration
interface MUST be effective on all compliant products. Any unknown key MUST be silently ignored.- Since:
- 3.1
- Author:
- Markus KARG (markus@headcrashing.eu)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SeBootstrap.Configuration.Builder
Builder for bootstrapSeBootstrap.Configuration
.static class
SeBootstrap.Configuration.SSLClientAuthentication
Secure socket client authentication policy
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PORT
Special value forPORT
property indicating that the implementation MUST use its default port.static int
FREE_PORT
Special value forPORT
property indicating that the implementation MUST scan for a free port.static String
HOST
Configuration key for the hostname or IP address an application is bound to.static String
PORT
Configuration key for the TCP port an application is bound to.static String
PROTOCOL
Configuration key for the protocol an application is bound to.static String
ROOT_PATH
Configuration key for the root path an application is bound to.static String
SSL_CLIENT_AUTHENTICATION
Configuration key for the secure socket client authentication policy.static String
SSL_CONTEXT
Configuration key for the secure socket configuration to be used.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default URI
baseUri()
Convenience method that returns a built theURI
for the application.default UriBuilder
baseUriBuilder()
Returns aUriBuilder
that includes the application root path.static SeBootstrap.Configuration.Builder
builder()
Creates a new bootstrap configuration builder instance.default boolean
hasProperty(String name)
Returns whether the property with the given name is configured, either explicitly or by default.default String
host()
Convenience method to get thehost
to be used.default int
port()
Convenience method to get the actually usedport
.Object
property(String name)
Returns the value of the property with the given name, ornull
if there is no property of that name.default String
protocol()
Convenience method to get theprotocol
to be used.default String
rootPath()
Convenience method to get therootPath
to be used.default SeBootstrap.Configuration.SSLClientAuthentication
sslClientAuthentication()
Convenience method to get the secure socket client authentication policy.default SSLContext
sslContext()
Convenience method to get thesslContext
to be used.
-
-
-
Field Detail
-
PROTOCOL
static final String PROTOCOL
Configuration key for the protocol an application is bound to.A compliant implementation at least MUST accept the strings
"HTTP"
and"HTTPS"
if these protocols are supported.The default value is
"HTTP"
.- Since:
- 3.1
- See Also:
- Constant Field Values
-
HOST
static final String HOST
Configuration key for the hostname or IP address an application is bound to.A compliant implementation at least MUST accept string values bearing hostnames, IP4 address text representations, and IP6 address text representations. If a hostname string, the special IP4 address string
"0.0.0.0"
or"::"
for IP6 is provided, the application MUST be bound to all IP addresses assigned to that hostname. If the hostname string is"localhost"
the application MUST be bound to the local host's loopback adapter only.The default value is
"localhost"
.- Since:
- 3.1
- See Also:
- Constant Field Values
-
PORT
static final String PORT
Configuration key for the TCP port an application is bound to.A compliant implementation MUST accept
java.lang.Integer
values.There is no default port mandated by this specification, but the default value of this property is
DEFAULT_PORT
(i. e.-1
). A compliant implementation MUST use its own default port when the value-1
is provided, and MAY apply (but is not obligated to) auto-selection and range-scanning algorithms.- Since:
- 3.1
- See Also:
- Constant Field Values
-
ROOT_PATH
static final String ROOT_PATH
Configuration key for the root path an application is bound to.The default value is
"/"
.- Since:
- 3.1
- See Also:
- Constant Field Values
-
SSL_CONTEXT
static final String SSL_CONTEXT
Configuration key for the secure socket configuration to be used.The default value is
SSLContext.getDefault()
.- Since:
- 3.1
- See Also:
- Constant Field Values
-
SSL_CLIENT_AUTHENTICATION
static final String SSL_CLIENT_AUTHENTICATION
Configuration key for the secure socket client authentication policy.A compliant implementation MUST accept
SeBootstrap.Configuration.SSLClientAuthentication
enums.The default value is
SSLClientAuthentication#NONE
.- Since:
- 3.1
- See Also:
- Constant Field Values
-
FREE_PORT
static final int FREE_PORT
Special value forPORT
property indicating that the implementation MUST scan for a free port.- Since:
- 3.1
- See Also:
- Constant Field Values
-
DEFAULT_PORT
static final int DEFAULT_PORT
Special value forPORT
property indicating that the implementation MUST use its default port.- Since:
- 3.1
- See Also:
- Constant Field Values
-
-
Method Detail
-
property
Object property(String name)
Returns the value of the property with the given name, ornull
if there is no property of that name.- Parameters:
name
- aString
specifying the name of the property.- Returns:
- an
Object
containing the value of the property, ornull
if no property exists matching the given name. - Since:
- 3.1
-
hasProperty
default boolean hasProperty(String name)
Returns whether the property with the given name is configured, either explicitly or by default.- Parameters:
name
- aString
specifying the name of the property.- Returns:
false
if no property exists matching the given name,true
otherwise.- Since:
- 3.1
-
protocol
default String protocol()
Convenience method to get theprotocol
to be used.Same as if calling
(String) property(PROTOCOL)
.- Returns:
- protocol to be used (e. g.
"HTTP")
. - Throws:
ClassCastException
- if protocol is not aString
.- Since:
- 3.1
- See Also:
PROTOCOL
-
host
default String host()
Convenience method to get thehost
to be used.Same as if calling
(String) property(HOST)
.- Returns:
- host name or IP address to be used (e. g.
"localhost"
or"0.0.0.0"
). - Throws:
ClassCastException
- if host is not aString
.- Since:
- 3.1
- See Also:
HOST
-
port
default int port()
Convenience method to get the actually usedport
.Same as if calling
(int) property(PORT)
.If the port was not explicitly given, this will return the port chosen implicitly by the JAX-RS implementation.
- Returns:
- port number actually used (e. g.
8080
). - Throws:
ClassCastException
- if port is not anInteger
.- Since:
- 3.1
- See Also:
PORT
-
rootPath
default String rootPath()
Convenience method to get therootPath
to be used.Same as if calling
(String) property(ROOT_PATH)
.- Returns:
- root path to be used, e.g.
"/"
. - Throws:
ClassCastException
- if root path is not aString
.- Since:
- 3.1
- See Also:
ROOT_PATH
-
sslContext
default SSLContext sslContext()
Convenience method to get thesslContext
to be used.Same as if calling
(SSLContext) property(SSL_CONTEXT)
.- Returns:
- root path to be used, e. g.
"/"
. - Throws:
ClassCastException
- if sslContext is not aSSLContext
.- Since:
- 3.1
- See Also:
SSL_CONTEXT
-
sslClientAuthentication
default SeBootstrap.Configuration.SSLClientAuthentication sslClientAuthentication()
Convenience method to get the secure socket client authentication policy.Same as if calling
(SSLClientAuthentication) property(SSL_CLIENT_AUTHENTICATION)
.- Returns:
- client authentication mode, e. g.
NONE
. - Throws:
ClassCastException
- if sslClientAuthentication is not aSeBootstrap.Configuration.SSLClientAuthentication
.- Since:
- 3.1
- See Also:
SSL_CLIENT_AUTHENTICATION
-
baseUriBuilder
default UriBuilder baseUriBuilder()
Returns aUriBuilder
that includes the application root path.- Returns:
- a
UriBuilder
for the application. - Since:
- 3.1
-
baseUri
default URI baseUri()
Convenience method that returns a built theURI
for the application.- Returns:
- a built
URI
for the application. - Since:
- 3.1
- See Also:
baseUriBuilder()
-
builder
static SeBootstrap.Configuration.Builder builder()
Creates a new bootstrap configuration builder instance.- Returns:
SeBootstrap.Configuration.Builder
for bootstrap configuration.- Since:
- 3.1
-
-