Interface HttpRestServer
- All Superinterfaces:
BaseLocatorAccessor, BaseLocatorAccessor.BaseLocatorBuilder<RestServer>, BaseLocatorAccessor.BaseLocatorMutator, BaseLocatorAccessor.BaseLocatorProperty, BasicAuthObservable<HttpRestServer>, Closable, Closable.CloseBuilder<ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>, ConnectionComponent<HttpServerContext>, ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>, ConnectionOpenable<HttpServerContext>, ConnectionOpenable.ConnectionOpenBuilder<HttpServerContext, ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>, ConnectionStatusAccessor, HttpExceptionHandlerAccessor, HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<HttpRestServer>, HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator, HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty, HttpExceptionHandlingAccessor, HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<HttpRestServer>, HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator, HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty, HttpsConnectionRequestObservable<HttpRestServer>, HttpServerInterceptable, KeyStoreDescriptorAccessor, KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpRestServer>, KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator, KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty, LinkComponent, MaxConnectionsAccessor, MaxConnectionsAccessor.MaxConnectionsBuilder<HttpRestServer>, MaxConnectionsAccessor.MaxConnectionsMutator, MaxConnectionsAccessor.MaxConnectionsProperty, MediaTypeFactoryLookup, MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup, Observable<RestEndpoint>, Observers<RestEndpoint, RestServer>, Openable, OpenedAccessor, PortAccessor, PortAccessor.PortBuilder<HttpRestServer>, PortAccessor.PortMutator, PortAccessor.PortProperty, PostHttpInterceptable<PostHttpServerInterceptor>, PostHttpServerInterceptable, PreHttpInterceptable<PreHttpServerInterceptor>, PreHttpServerInterceptable, RealmAccessor, RealmAccessor.RealmBuilder<RestServer>, RealmAccessor.RealmMutator, RealmAccessor.RealmProperty, RestServer, SchemeAccessor, SchemeAccessor.SchemeBuilder<HttpRestServer>, SchemeAccessor.SchemeMutator, SchemeAccessor.SchemeProperty
- All Known Subinterfaces:
HttpRestRegistryServer<DESC,B>
- All Known Implementing Classes:
AbstractHttpRestRegistryServerDecorator, AbstractHttpRestServerDecorator, JdkHttpRestServer, JdkHttpRestServerSingleton
public interface HttpRestServer
extends RestServer, HttpServerInterceptable, HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty, HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<HttpRestServer>, HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty, HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<HttpRestServer>, LinkComponent, ConnectionStatusAccessor, ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>, BasicAuthObservable<HttpRestServer>, HttpsConnectionRequestObservable<HttpRestServer>, PortAccessor.PortProperty, PortAccessor.PortBuilder<HttpRestServer>, SchemeAccessor.SchemeProperty, SchemeAccessor.SchemeBuilder<HttpRestServer>, KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty, KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpRestServer>, MaxConnectionsAccessor.MaxConnectionsProperty, MaxConnectionsAccessor.MaxConnectionsBuilder<HttpRestServer>
Extends a
RestServer to be capable of opening a server socket on the
local host with the provided port number via ConnectionOpenable.open(Object) or with an
additional maximum number of connections via open(int, int). To open
a HTTPS port, use the methods such as: open(KeyStoreDescriptor, int)
or open(KeyStoreDescriptor, int, int) or
open(String, KeyStoreDescriptor, int) or
open(String, KeyStoreDescriptor, int, int). A HttpRestServer
can be shutdown via Closable.close().-
Nested Class Summary
Nested classes/interfaces inherited from interface BaseLocatorAccessor
BaseLocatorAccessor.BaseLocatorBuilder<B>, BaseLocatorAccessor.BaseLocatorMutator, BaseLocatorAccessor.BaseLocatorPropertyNested classes/interfaces inherited from interface Closable
Closable.CloseAutomaton, Closable.CloseBuilder<B>Nested classes/interfaces inherited from interface ConnectionComponent
ConnectionComponent.ConnectionAutomaton<CON>, ConnectionComponent.ConnectionComponentBuilder<CON,B> Nested classes/interfaces inherited from interface ConnectionOpenable
ConnectionOpenable.ConnectionOpenAutomaton<CON>, ConnectionOpenable.ConnectionOpenBuilder<CON,B> Nested classes/interfaces inherited from interface ConnectionStatusAccessor
ConnectionStatusAccessor.ConnectionStatusMutator, ConnectionStatusAccessor.ConnectionStatusPropertyNested classes/interfaces inherited from interface HttpExceptionHandlerAccessor
HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B>, HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator, HttpExceptionHandlerAccessor.HttpExceptionHandlerPropertyNested classes/interfaces inherited from interface HttpExceptionHandlingAccessor
HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B>, HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator, HttpExceptionHandlingAccessor.HttpExceptionHandlingPropertyNested classes/interfaces inherited from interface KeyStoreDescriptorAccessor
KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<B>, KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator, KeyStoreDescriptorAccessor.KeyStoreDescriptorPropertyNested classes/interfaces inherited from interface LinkComponent
LinkComponent.LinkAutomaton, LinkComponent.LinkComponentBuilder<B>Nested classes/interfaces inherited from interface MaxConnectionsAccessor
MaxConnectionsAccessor.MaxConnectionsBuilder<B>, MaxConnectionsAccessor.MaxConnectionsMutator, MaxConnectionsAccessor.MaxConnectionsPropertyNested classes/interfaces inherited from interface MediaTypeFactoryLookup
MediaTypeFactoryLookup.MutableMediaTypeFactoryLookupNested classes/interfaces inherited from interface Openable
Openable.OpenAutomaton, Openable.OpenBuilder<B>Nested classes/interfaces inherited from interface OpenedAccessor
OpenedAccessor.OpenedMutator, OpenedAccessor.OpenedPropertyNested classes/interfaces inherited from interface PortAccessor
PortAccessor.PortBuilder<B>, PortAccessor.PortMutator, PortAccessor.PortPropertyNested classes/interfaces inherited from interface RealmAccessor
RealmAccessor.RealmBuilder<B>, RealmAccessor.RealmMutator, RealmAccessor.RealmPropertyNested classes/interfaces inherited from interface SchemeAccessor
SchemeAccessor.SchemeBuilder<B>, SchemeAccessor.SchemeMutator, SchemeAccessor.SchemeProperty -
Method Summary
Modifier and TypeMethodDescriptiondefault voidopen()default voidopen(int aPort) Opens the HTTP sever connection (socket) at the given port.default voidopen(int aPort, int aMaxConnections) Opens the HTTP sever connection (socket) at the given port allowing the given number of maximum connections at the same time.default voidopen(String aProtocol, KeyStoreDescriptor aStoreDescriptor) Same asopen(String, KeyStoreDescriptor, int)but: The number of maximum connections at the same time is decided upon by the implementations's default value.default voidopen(String aProtocol, KeyStoreDescriptor aStoreDescriptor, int aPort) Same asopen(String, KeyStoreDescriptor, int, int)but: The number of maximum connections at the same time is decided upon by the implementations's default value.voidopen(String aProtocol, KeyStoreDescriptor aStoreDescriptor, int aPort, int aMaxConnections) Opens the HTTPS sever connection (socket) at the given port allowing the given number of maximum connections at the same time using the provided HTTPS configuration parameters.default voidopen(Scheme aScheme, KeyStoreDescriptor aStoreDescriptor) Same asopen(String, KeyStoreDescriptor, int)but: The number of maximum connections at the same time is decided upon by the implementations's default value.default voidopen(Scheme aScheme, KeyStoreDescriptor aStoreDescriptor, int aPort) Same asopen(String, KeyStoreDescriptor, int, int)but: The number of maximum connections at the same time is decided upon by the implementations's default value.default voidopen(Scheme aScheme, KeyStoreDescriptor aStoreDescriptor, int aPort, int aMaxConnections) Opens the HTTPS sever connection (socket) at the given port allowing the given number of maximum connections at the same time using the provided HTTPS configuration parameters.default voidopen(KeyStoreDescriptor aStoreDescriptor) Same asopen(String, KeyStoreDescriptor, int)but: The protocol for the underlyingSSLContextused is set to "TLS".default voidopen(KeyStoreDescriptor aStoreDescriptor, int aPort) Same asopen(String, KeyStoreDescriptor, int, int)but: The protocol for the underlyingSSLContextused is set to "TLS".default voidopen(KeyStoreDescriptor aStoreDescriptor, int aPort, int aMaxConnections) Same asopen(String, KeyStoreDescriptor, int, int)but: The protocol for the underlyingSSLContextused is set to "TLS".default voidopen(HttpServerContext aConnection) default HttpRestServerwithBaseLocator(String aBaseLocator) default HttpRestServerdefault HttpRestServerwithCloseIn(int aCloseMillis) default HttpRestServerdefault HttpRestServerwithHttpExceptionHandler(HttpExceptionHandler aHttpErrorHandler) Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.default HttpRestServerwithHttpExceptionHandling(HttpExceptionHandling aHttpErrorHandling) Sets theHttpExceptionHandlingfor theHttpExceptionHandlingproperty.default HttpRestServerwithKeyStoreDescriptor(KeyStoreDescriptor aKeyStoreDescriptor) default HttpRestServerwithMaxConnections(int aMaxConnections) default HttpRestServerwithOpen(int aPort) Builder method for opening theHttpRestServer.default HttpRestServerwithOpen(HttpServerContext aConnection) default HttpRestServerwithPort(int aPort) default HttpRestServerwithProtocol(String aProtocol) default HttpRestServerdefault HttpRestServerwithScheme(Scheme aScheme) Methods inherited from interface BaseLocatorAccessor
getBaseLocatorMethods inherited from interface BaseLocatorAccessor.BaseLocatorMutator
setBaseLocatorMethods inherited from interface BaseLocatorAccessor.BaseLocatorProperty
letBaseLocatorMethods inherited from interface BasicAuthObservable
onBasicAuthRequestMethods inherited from interface Closable
close, closeIn, closeQuietly, closeUncheckedMethods inherited from interface Closable.CloseBuilder
withCloseUncheckedMethods inherited from interface ConnectionOpenable
openUncheckedMethods inherited from interface ConnectionOpenable.ConnectionOpenBuilder
withOpenUncheckedMethods inherited from interface ConnectionStatusAccessor
getConnectionStatus, isOpenedMethods inherited from interface HttpExceptionHandlerAccessor
getHttpExceptionHandlerMethods inherited from interface HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder
withOnHttpExceptionMethods inherited from interface HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
onHttpException, setHttpExceptionHandlerMethods inherited from interface HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
letHttpExceptionHandlerMethods inherited from interface HttpExceptionHandlingAccessor
getHttpExceptionHandlingMethods inherited from interface HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator
setHttpExceptionHandlingMethods inherited from interface HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
letHttpExceptionHandlingMethods inherited from interface HttpsConnectionRequestObservable
onConnectionRequestMethods inherited from interface HttpServerInterceptable
addHttpInterceptor, hasHttpInterceptor, removeHttpInterceptorMethods inherited from interface KeyStoreDescriptorAccessor
getKeyStoreDescriptorMethods inherited from interface KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator
setKeyStoreDescriptorMethods inherited from interface KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
letKeyStoreDescriptorMethods inherited from interface MaxConnectionsAccessor
getMaxConnectionsMethods inherited from interface MaxConnectionsAccessor.MaxConnectionsMutator
setMaxConnectionsMethods inherited from interface MaxConnectionsAccessor.MaxConnectionsProperty
letMaxConnectionsMethods inherited from interface MediaTypeFactoryLookup
getFactoryMediaTypes, hasMediaTypeFactory, toMediaTypeFactoryMethods inherited from interface MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
addMediaTypeFactoryMethods inherited from interface Observable
hasObserver, subscribeObserver, unsubscribeObserverMethods inherited from interface Observers
disableObservers, enableObservers, isObserversActive, observers, setObserversActiveMethods inherited from interface Openable
openUncheckedMethods inherited from interface PortAccessor
getPortMethods inherited from interface PortAccessor.PortMutator
setPortMethods inherited from interface PortAccessor.PortProperty
letPortMethods inherited from interface PostHttpInterceptable
addPostHttpInterceptor, hasPostHttpInterceptor, removePostHttpInterceptorMethods inherited from interface PreHttpInterceptable
addPreHttpInterceptor, hasPreHttpInterceptor, removePreHttpInterceptorMethods inherited from interface RealmAccessor
getRealmMethods inherited from interface RealmAccessor.RealmMutator
setRealmMethods inherited from interface RealmAccessor.RealmProperty
letRealmMethods inherited from interface RestServer
onDelete, onDelete, onGet, onGet, onPost, onPost, onPut, onPut, onRequest, onRequest, onRequest, onRequest, onRequest, withDisableObservers, withEnableObservers, withObserversActiveMethods inherited from interface SchemeAccessor
getScheme, toProtocolMethods inherited from interface SchemeAccessor.SchemeMutator
setProtocol, setSchemeMethods inherited from interface SchemeAccessor.SchemeProperty
letProtocol, letScheme
-
Method Details
-
withHttpExceptionHandler
Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.- Specified by:
withHttpExceptionHandlerin interfaceHttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<HttpRestServer>- Parameters:
aHttpErrorHandler- TheHttpExceptionHandlerto be stored by theHttpExceptionHandlerproperty.- Returns:
- The builder for applying multiple build operations.
-
withHttpExceptionHandling
Sets theHttpExceptionHandlingfor theHttpExceptionHandlingproperty.- Specified by:
withHttpExceptionHandlingin interfaceHttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<HttpRestServer>- Parameters:
aHttpErrorHandling- TheHttpExceptionHandlingto be stored by theHttpExceptionHandlingproperty.- Returns:
- The builder for applying multiple build operations.
-
withRealm
- Specified by:
withRealmin interfaceRealmAccessor.RealmBuilder<RestServer>- Specified by:
withRealmin interfaceRestServer
-
withBaseLocator
- Specified by:
withBaseLocatorin interfaceBaseLocatorAccessor.BaseLocatorBuilder<RestServer>- Specified by:
withBaseLocatorin interfaceRestServer
-
withClose
- Specified by:
withClosein interfaceClosable.CloseBuilder<ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>- Throws:
IOException
-
withCloseQuietly
- Specified by:
withCloseQuietlyin interfaceClosable.CloseBuilder<ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>
-
withCloseIn
- Specified by:
withCloseInin interfaceClosable.CloseBuilder<ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>
-
withOpen
- Specified by:
withOpenin interfaceConnectionOpenable.ConnectionOpenBuilder<HttpServerContext, ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>- Throws:
IOException
-
withOpen
Builder method for opening theHttpRestServer. Delegates toopen(int)and returns this method.- Parameters:
aPort- The port on which to listen for requests.- Returns:
- This instance for applying method chaining.
- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
-
withPort
- Specified by:
withPortin interfacePortAccessor.PortBuilder<HttpRestServer>
-
withScheme
- Specified by:
withSchemein interfaceSchemeAccessor.SchemeBuilder<HttpRestServer>
-
withProtocol
- Specified by:
withProtocolin interfaceSchemeAccessor.SchemeBuilder<HttpRestServer>
-
withKeyStoreDescriptor
- Specified by:
withKeyStoreDescriptorin interfaceKeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpRestServer>
-
withMaxConnections
- Specified by:
withMaxConnectionsin interfaceMaxConnectionsAccessor.MaxConnectionsBuilder<HttpRestServer>
-
open
- Specified by:
openin interfaceOpenable- Throws:
IOException
-
open
Opens the HTTP sever connection (socket) at the given port.- Parameters:
aPort- The port on which to listen for requests.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
-
open
Opens the HTTP sever connection (socket) at the given port allowing the given number of maximum connections at the same time.- Parameters:
aPort- The port on which to listen for requests.aMaxConnections- The number of maximum connections at the same time.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
-
open
default void open(String aProtocol, KeyStoreDescriptor aStoreDescriptor, int aPort) throws IOException Same asopen(String, KeyStoreDescriptor, int, int)but:- The number of maximum connections at the same time is decided upon by the implementations's default value.
- Parameters:
aProtocol- The protocol to use, e.g. "TLS".aStoreDescriptor- The store descriptor describing yourKeyStorerequired for HTTPS.aPort- The port on which to listen for requests.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
-
open
Same asopen(String, KeyStoreDescriptor, int)but:- The number of maximum connections at the same time is decided upon by the implementations's default value.
- Parameters:
aProtocol- The protocol to use, e.g. "TLS".aStoreDescriptor- The store descriptor describing yourKeyStorerequired for HTTPS.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
-
open
default void open(KeyStoreDescriptor aStoreDescriptor, int aPort, int aMaxConnections) throws IOException Same asopen(String, KeyStoreDescriptor, int, int)but:- The protocol for the underlying
SSLContextused is set to "TLS". - The type of
KeyStoreis set to "JKS". - The password for the
KeyStore's key is assumed to be the same as the providedKeyStorepassword.
- Parameters:
aStoreDescriptor- The store descriptor describing yourKeyStorerequired for HTTPS.aPort- The port on which to listen for requests.aMaxConnections- The number of maximum connections at the same time.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
- The protocol for the underlying
-
open
Same asopen(String, KeyStoreDescriptor, int, int)but:- The protocol for the underlying
SSLContextused is set to "TLS". - The type of
KeyStoreis set to "JKS".
- Parameters:
aStoreDescriptor- The store descriptor describing yourKeyStorerequired for HTTPS.aPort- The port on which to listen for requests.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
- The protocol for the underlying
-
open
Same asopen(String, KeyStoreDescriptor, int)but:- The protocol for the underlying
SSLContextused is set to "TLS". - The type of
KeyStoreis set to "JKS".
- Parameters:
aStoreDescriptor- The store descriptor describing yourKeyStorerequired for HTTPS.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
- The protocol for the underlying
-
open
default void open(Scheme aScheme, KeyStoreDescriptor aStoreDescriptor, int aPort, int aMaxConnections) throws IOException Opens the HTTPS sever connection (socket) at the given port allowing the given number of maximum connections at the same time using the provided HTTPS configuration parameters.- Parameters:
aScheme- TheSchemeto use, e.g.Scheme.HTTPSdefaults to "TLS".aStoreDescriptor- The store descriptor describing yourKeyStorerequired for HTTPS.aPort- The port on which to listen for requests.aMaxConnections- The number of maximum connections at the same time.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
-
open
default void open(Scheme aScheme, KeyStoreDescriptor aStoreDescriptor, int aPort) throws IOException Same asopen(String, KeyStoreDescriptor, int, int)but:- The number of maximum connections at the same time is decided upon by the implementations's default value.
- Parameters:
aScheme- TheSchemeto use, e.g.Scheme.HTTPSdefaults to "TLS".aStoreDescriptor- The store descriptor describing yourKeyStorerequired for HTTPS.aPort- The port on which to listen for requests.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
-
open
Same asopen(String, KeyStoreDescriptor, int)but:- The number of maximum connections at the same time is decided upon by the implementations's default value.
- Parameters:
aScheme- TheSchemeto use, e.g.Scheme.HTTPSdefaults to "TLS".aStoreDescriptor- The store descriptor describing yourKeyStorerequired for HTTPS.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
-
open
void open(String aProtocol, KeyStoreDescriptor aStoreDescriptor, int aPort, int aMaxConnections) throws IOException Opens the HTTPS sever connection (socket) at the given port allowing the given number of maximum connections at the same time using the provided HTTPS configuration parameters.- Parameters:
aProtocol- The protocol to use, e.g. "TLS".aStoreDescriptor- The store descriptor describing yourKeyStorerequired for HTTPS.aPort- The port on which to listen for requests.aMaxConnections- The number of maximum connections at the same time.- Throws:
IOException- thrown in case something went wrong such as the port being already in use.
-
open
- Specified by:
openin interfaceConnectionOpenable<HttpServerContext>- Throws:
IOException
-