Class HttpServerContextBuilder
java.lang.Object
org.refcodes.web.HttpServerContextBuilder
- All Implemented Interfaces:
MaxConnectionsAccessor, MaxConnectionsAccessor.MaxConnectionsBuilder<HttpServerContextBuilder>, MaxConnectionsAccessor.MaxConnectionsMutator, MaxConnectionsAccessor.MaxConnectionsProperty, PortAccessor, PortAccessor.PortBuilder<HttpServerContextBuilder>, PortAccessor.PortMutator, PortAccessor.PortProperty, KeyStoreDescriptorAccessor, KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpServerContextBuilder>, KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator, KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty, HttpServerContext, SchemeAccessor, SchemeAccessor.SchemeBuilder<HttpServerContextBuilder>, SchemeAccessor.SchemeMutator, SchemeAccessor.SchemeProperty
public class HttpServerContextBuilder
extends Object
implements HttpServerContext, SchemeAccessor.SchemeProperty, SchemeAccessor.SchemeBuilder<HttpServerContextBuilder>, KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty, KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpServerContextBuilder>, PortAccessor.PortProperty, PortAccessor.PortBuilder<HttpServerContextBuilder>, MaxConnectionsAccessor.MaxConnectionsProperty, MaxConnectionsAccessor.MaxConnectionsBuilder<HttpServerContextBuilder>
The
HttpServerContextBuilder implements the HttpServerContext
interface extending it with builder functionality..-
Nested Class Summary
Nested classes/interfaces inherited from interface KeyStoreDescriptorAccessor
KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<B>, KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator, KeyStoreDescriptorAccessor.KeyStoreDescriptorPropertyNested classes/interfaces inherited from interface MaxConnectionsAccessor
MaxConnectionsAccessor.MaxConnectionsBuilder<B>, MaxConnectionsAccessor.MaxConnectionsMutator, MaxConnectionsAccessor.MaxConnectionsPropertyNested classes/interfaces inherited from interface PortAccessor
PortAccessor.PortBuilder<B>, PortAccessor.PortMutator, PortAccessor.PortPropertyNested classes/interfaces inherited from interface SchemeAccessor
SchemeAccessor.SchemeBuilder<B>, SchemeAccessor.SchemeMutator, SchemeAccessor.SchemeProperty -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aHttpClientContextwith a default schemeScheme.HTTPfor port 8080.HttpServerContextBuilder(int aPort) Constructs aHttpClientContextwith a default scheme.HttpServerContextBuilder(String aProtocol, int aPort) Constructs aHttpClientContextwith a default scheme.HttpServerContextBuilder(String aProtocol, int aPort, KeyStoreDescriptor aKeyStoreDescriptor, int aMaxConnections) Constructs aHttpClientContextwith the given data.HttpServerContextBuilder(Scheme aScheme, int aPort) Constructs aHttpClientContextwith a default scheme.HttpServerContextBuilder(Scheme aScheme, int aPort, KeyStoreDescriptor aKeyStoreDescriptor, int aMaxConnections) Constructs aHttpClientContextwith the given data. -
Method Summary
Modifier and TypeMethodDescriptionintintgetPort()Retrieves the UrlScheme from the URL scheme.voidsetKeyStoreDescriptor(KeyStoreDescriptor aKeyStoreDescriptor) voidsetMaxConnections(int aMaxConnections) voidsetPort(int aPort) voidsetProtocol(String aProtocol) Sets the protocolStringrepresentation for the scheme property.voidSets the UrlScheme for the URL scheme.Retrieves the protocol representation from theScheme.withKeyStoreDescriptor(KeyStoreDescriptor aKeyStoreDescriptor) withMaxConnections(int aMaxConnections) withPort(int aPort) withProtocol(String aProtocol) Sets the protocol for the URL scheme.withScheme(Scheme aScheme) Sets the UrlScheme for the URL scheme.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
letKeyStoreDescriptorMethods inherited from interface MaxConnectionsAccessor.MaxConnectionsProperty
letMaxConnectionsMethods inherited from interface PortAccessor.PortProperty
letPortMethods inherited from interface SchemeAccessor.SchemeProperty
letProtocol, letScheme
-
Field Details
-
DEFAULT_SCHEME
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
-
Constructor Details
-
HttpServerContextBuilder
public HttpServerContextBuilder()Constructs aHttpClientContextwith a default schemeScheme.HTTPfor port 8080. -
HttpServerContextBuilder
public HttpServerContextBuilder(int aPort) Constructs aHttpClientContextwith a default scheme.- Parameters:
aPort- The TCP port to be used.
-
HttpServerContextBuilder
Constructs aHttpClientContextwith a default scheme.- Parameters:
aScheme- TheScheme(HTTP or HTTPS) to be used.aPort- The TCP port to be used.
-
HttpServerContextBuilder
Constructs aHttpClientContextwith a default scheme.- Parameters:
aProtocol- The protocol such as theTransportLayerProtocol.aPort- The TCP port to be used.
-
HttpServerContextBuilder
public HttpServerContextBuilder(Scheme aScheme, int aPort, KeyStoreDescriptor aKeyStoreDescriptor, int aMaxConnections) Constructs aHttpClientContextwith the given data.- Parameters:
aScheme- TheScheme(HTTP or HTTPS) to be used.aPort- The TCP port to be used.aKeyStoreDescriptor- The descriptor describing the keystore to be used.aMaxConnections- The maximum allowed open connections.
-
HttpServerContextBuilder
public HttpServerContextBuilder(String aProtocol, int aPort, KeyStoreDescriptor aKeyStoreDescriptor, int aMaxConnections) Constructs aHttpClientContextwith the given data.- Parameters:
aProtocol- The protocol such as theTransportLayerProtocolelements.aPort- The TCP port to be used.aKeyStoreDescriptor- The descriptor describing the keystore to be used.aMaxConnections- The maximum allowed open connections.
-
-
Method Details
-
getKeyStoreDescriptor
- Specified by:
getKeyStoreDescriptorin interfaceKeyStoreDescriptorAccessor
-
getMaxConnections
public int getMaxConnections()- Specified by:
getMaxConnectionsin interfaceMaxConnectionsAccessor
-
getPort
public int getPort()- Specified by:
getPortin interfacePortAccessor
-
getScheme
Retrieves the UrlScheme from the URL scheme.- Specified by:
getSchemein interfaceSchemeAccessor- Returns:
- The UrlScheme stored by the URL scheme.
-
setKeyStoreDescriptor
- Specified by:
setKeyStoreDescriptorin interfaceKeyStoreDescriptorAccessor.KeyStoreDescriptorMutator
-
setMaxConnections
public void setMaxConnections(int aMaxConnections) - Specified by:
setMaxConnectionsin interfaceMaxConnectionsAccessor.MaxConnectionsMutator
-
setPort
public void setPort(int aPort) - Specified by:
setPortin interfacePortAccessor.PortMutator
-
setScheme
Sets the UrlScheme for the URL scheme.- Specified by:
setSchemein interfaceSchemeAccessor.SchemeMutator- Parameters:
aScheme- The UrlScheme to be stored by the URL scheme.
-
toProtocol
Retrieves the protocol representation from theScheme. In case of a scheme unknown by theSchemeenumeration, thenSchemeAccessor.getScheme()might return null whilstSchemeAccessor.toProtocol()still retrieves the unknown scheme's protocol representation (as ofSchemeAccessor.SchemeMutator.setProtocol(String)).- Specified by:
toProtocolin interfaceSchemeAccessor- Returns:
- The protocol representation for the URL.
-
setProtocol
Sets the protocolStringrepresentation for the scheme property. You must provide the scheme's specific part as well. In case of HTTP, provide "http://". In case your provided protocol is unknown by theSchemeenumeration, then the scheme property will not be set, though theSchemeAccessor.toProtocol()still returns your protocol.- Specified by:
setProtocolin interfaceSchemeAccessor.SchemeMutator- Parameters:
aProtocol- The UrlScheme'sStringrepresentation to be stored by the URL scheme.
-
withKeyStoreDescriptor
- Specified by:
withKeyStoreDescriptorin interfaceKeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpServerContextBuilder>
-
withMaxConnections
- Specified by:
withMaxConnectionsin interfaceMaxConnectionsAccessor.MaxConnectionsBuilder<HttpServerContextBuilder>
-
withPort
- Specified by:
withPortin interfacePortAccessor.PortBuilder<HttpServerContextBuilder>
-
withProtocol
Sets the protocol for the URL scheme.- Specified by:
withProtocolin interfaceSchemeAccessor.SchemeBuilder<HttpServerContextBuilder>- Parameters:
aProtocol- The protocol to be stored by the URL scheme.- Returns:
- The builder for applying multiple build operations.
-
withScheme
Sets the UrlScheme for the URL scheme.- Specified by:
withSchemein interfaceSchemeAccessor.SchemeBuilder<HttpServerContextBuilder>- Parameters:
aScheme- The UrlScheme to be stored by the URL scheme.- Returns:
- The builder for applying multiple build operations.
-