Class JdkHttpRestServer
- All Implemented Interfaces:
Closable, Closable.CloseBuilder<ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>, ConnectionComponent<HttpServerContext>, ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>, ConnectionOpenable<HttpServerContext>, ConnectionOpenable.ConnectionOpenBuilder<HttpServerContext, ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>, ConnectionStatusAccessor, LinkComponent, Openable, OpenedAccessor, MaxConnectionsAccessor, MaxConnectionsAccessor.MaxConnectionsBuilder<HttpRestServer>, MaxConnectionsAccessor.MaxConnectionsMutator, MaxConnectionsAccessor.MaxConnectionsProperty, Disposable, PortAccessor, PortAccessor.PortBuilder<HttpRestServer>, PortAccessor.PortMutator, PortAccessor.PortProperty, Observable<RestEndpoint>, Observers<RestEndpoint, RestServer>, HttpExceptionHandlerAccessor, HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<HttpRestServer>, HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator, HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty, HttpExceptionHandlingAccessor, HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<HttpRestServer>, HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator, HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty, HttpRestServer, RestServer, KeyStoreDescriptorAccessor, KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpRestServer>, KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator, KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty, BaseLocatorAccessor, BaseLocatorAccessor.BaseLocatorBuilder<RestServer>, BaseLocatorAccessor.BaseLocatorMutator, BaseLocatorAccessor.BaseLocatorProperty, BasicAuthObservable<HttpRestServer>, HttpsConnectionRequestObservable<HttpRestServer>, HttpServerInterceptable, MediaTypeFactoryLookup, MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup, PostHttpInterceptable<PostHttpServerInterceptor>, PostHttpServerInterceptable, PreHttpInterceptable<PreHttpServerInterceptor>, PreHttpServerInterceptable, RealmAccessor, RealmAccessor.RealmBuilder<RestServer>, RealmAccessor.RealmMutator, RealmAccessor.RealmProperty, SchemeAccessor, SchemeAccessor.SchemeBuilder<HttpRestServer>, SchemeAccessor.SchemeMutator, SchemeAccessor.SchemeProperty
- Direct Known Subclasses:
JdkHttpRestServerSingleton
Implementation of the HttpRestServer interface using the
HttpRestServer defined in the com.sun.net.httpserver
package. The JdkHttpRestServer is being initialized with some common
MediaTypeFactory instances (as implemented by the
AbstractRestServer). At the time of writing this document the
MediaTypeFactory instances being preconfigured are:
The JdkHttpRestServer supports HTTP as well as HTTPS protocols as
being based on the HttpRestServer as well as on the
HttpsServer. For opening up an HTTPS connection, refer to the methods
such as HttpRestServer.open(String, KeyStoreDescriptor, int) or
HttpRestServer.open(KeyStoreDescriptor, int) and the like.
Set the system property SystemProperty.LOG_DEBUG to true (set when
invoking the JRA by passing the argument -Dlog.debug=true to the
java executable) to log additional erroneous situations e.g.
related to content types and accept types alongside marshaling and
unmarshaling.
Options type) for felexible but still typesafe
configuration.-
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 -
Field Summary
FieldsFields inherited from class AbstractRestServer
_isVerbose -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aJdkHttpRestServer.JdkHttpRestServer(boolean isVerbose) Constructs aJdkHttpRestServer.JdkHttpRestServer(ExecutorService aExecutorService) Constructs aJdkHttpRestServer.JdkHttpRestServer(ExecutorService aExecutorService, boolean isVerbose) Constructs aJdkHttpRestServer.JdkHttpRestServer(ThreadingModel aThreadingModel) Constructs aJdkHttpRestServer.JdkHttpRestServer(ThreadingModel aThreadingModel, boolean isVerbose) Constructs aJdkHttpRestServer. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddPostHttpInterceptor(PostHttpServerInterceptor aPostInterceptor) booleanaddPreHttpInterceptor(PreHttpServerInterceptor aPreInterceptor) voidclose()Retrieves theHttpExceptionHandlerfrom theHttpExceptionHandlerproperty.Retrieves theHttpExceptionHandlingfrom theHttpExceptionHandlingproperty.protected HttpServerGets the HTTP server.intintgetPort()booleanhasPostHttpInterceptor(PostHttpServerInterceptor aPostInterceptor) booleanhasPreHttpInterceptor(PreHttpServerInterceptor aPreInterceptor) onBasicAuthRequest(BasicAuthObserver aBasicAuthObserver) protected voidopen(HttpServer aHttpServer) A hook to be used when using customHttpRestServer(HttpsServer) by custom open(...) methods of sub-classes of thisJdkHttpRestServer.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.protected voidpostIntercept(HttpServerRequest aRequest, HttpServerResponse aResponse) Invoked to post-process aHttpServerRequestalongside aHttpServerResponse.protected voidpreIntercept(HttpServerRequest aRequest, HttpServerResponse aResponse) Invoked to pre-process aHttpServerRequestalongside aHttpServerResponse.booleanremovePostHttpInterceptor(PostHttpServerInterceptor aPostInterceptor) booleanremovePreHttpInterceptor(PreHttpServerInterceptor aPreInterceptor) voidsetHttpExceptionHandler(HttpExceptionHandler aHttpErrorHandler) Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.voidsetHttpExceptionHandling(HttpExceptionHandling aHttpErrorHandling) Sets theHttpExceptionHandlingfor theHttpExceptionHandlingproperty.voidsetKeyStoreDescriptor(KeyStoreDescriptor aKeyStoreDescriptor) voidsetMaxConnections(int aMaxConnections) voidsetPort(int aPort) voidsetProtocol(String aProtocol) voidwithBaseLocator(String aBaseLocator) withCloseIn(int aCloseMillis) withHttpExceptionHandler(HttpExceptionHandler aHttpErrorHandler) Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.withHttpExceptionHandling(HttpExceptionHandling aHttpErrorHandling) Sets theHttpExceptionHandlingfor theHttpExceptionHandlingproperty.withKeyStoreDescriptor(KeyStoreDescriptor aKeyStoreDescriptor) withMaxConnections(int aMaxConnections) withObserversActive(boolean isActive) withOnHttpException(HttpExceptionHandler aHttpExceptionHandler) Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.withOpen(int aPort) Builder method for opening theHttpRestServer.withOpen(HttpServerContext aConnection) withOpenUnchecked(HttpServerContext aConnection) withPort(int aPort) withProtocol(String aProtocol) withScheme(Scheme aScheme) Methods inherited from class AbstractRestServer
addMediaTypeFactory, dispose, fireEvent, getBaseLocator, getFactoryMediaTypes, getRealm, initMedaTypeFactories, isObserversActive, observers, onHttpRequest, setBaseLocator, setObserversActive, setRealm, subscribeObserver, toMediaTypeFactory, toNegotiatedContenType, toResponseBody, unsubscribeObserverMethods inherited from class AbstractObservable
clear, doHandleEventListenerException, fireEvent, getThreadPriority, hasObserver, isEmpty, setThreadPriority, sizeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BaseLocatorAccessor
getBaseLocatorMethods inherited from interface BaseLocatorAccessor.BaseLocatorMutator
setBaseLocatorMethods inherited from interface BaseLocatorAccessor.BaseLocatorProperty
letBaseLocatorMethods inherited from interface Closable
closeIn, closeQuietly, closeUncheckedMethods inherited from interface ConnectionOpenable
openUncheckedMethods inherited from interface ConnectionStatusAccessor
isOpenedMethods inherited from interface HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
onHttpExceptionMethods inherited from interface HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
letHttpExceptionHandlerMethods inherited from interface HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
letHttpExceptionHandlingMethods inherited from interface HttpRestServer
open, open, open, open, open, open, open, open, open, open, open, openMethods inherited from interface HttpServerInterceptable
addHttpInterceptor, hasHttpInterceptor, removeHttpInterceptorMethods inherited from interface KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
letKeyStoreDescriptorMethods 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.PortProperty
letPortMethods 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, onRequestMethods inherited from interface SchemeAccessor.SchemeProperty
letProtocol, letScheme
-
Field Details
-
CONTEXT_PATH
-
-
Constructor Details
-
JdkHttpRestServer
Constructs aJdkHttpRestServer. UseHttpRestServer.open(int)or similar to make it listen on your port. The providedThreadingModeldefines whether to use a single-threaded or a multi-threaded threading model. Threads are created as daemon threads. For more control on thread generation use the constructorJdkHttpRestServer(ExecutorService).- Parameters:
aThreadingModel- Specifies to either use a single-threaded threading model (noExecutorService) or a multi-threaded threading model with a defaultExecutorServiceas ofControlFlowUtility.createCachedExecutorService(boolean).
-
JdkHttpRestServer
Constructs aJdkHttpRestServer. UseHttpRestServer.open(int)or similar to make it listen on your port. The providedThreadingModeldefines whether to use a single-threaded or a multi-threaded threading model. Threads are created as daemon threads. For more control on thread generation use the constructorJdkHttpRestServer(ExecutorService).- Parameters:
aThreadingModel- Specifies to either use a single-threaded threading model (noExecutorService) or a multi-threaded threading model with a defaultExecutorServiceas ofControlFlowUtility.createCachedExecutorService(boolean).isVerbose- When true, any unknown content- and accept-types are logged.
-
JdkHttpRestServer
public JdkHttpRestServer()Constructs aJdkHttpRestServer. UseHttpRestServer.open(int)or similar to make it listen on your port. Uses a multi threaded threading model with a defaultExecutorServiceas ofControlFlowUtility.createCachedExecutorService(boolean). Threads are created as daemon threads. For more control on thread generation use the constructorJdkHttpRestServer(ExecutorService). -
JdkHttpRestServer
public JdkHttpRestServer(boolean isVerbose) Constructs aJdkHttpRestServer. UseHttpRestServer.open(int)or similar to make it listen on your port. Uses a multi threaded threading model with a defaultExecutorServiceas ofControlFlowUtility.createCachedExecutorService(boolean). Threads are created as daemon threads. For more control on thread generation use the constructorJdkHttpRestServer(ExecutorService).- Parameters:
isVerbose- When true, any unknown content- and accept-types are logged.
-
JdkHttpRestServer
Constructs aJdkHttpRestServer. UseHttpRestServer.open(int)or similar to make it listen on your port. Uses a multi threaded threading model.- Parameters:
aExecutorService- An executor service to be used when creatingThreads.
-
JdkHttpRestServer
Constructs aJdkHttpRestServer. UseHttpRestServer.open(int)or similar to make it listen on your port. Uses a multi threaded threading model.- Parameters:
aExecutorService- An executor service to be used when creatingThreads.isVerbose- When true, any unknown content- and accept-types are logged.
-
-
Method Details
-
close
- Specified by:
closein interfaceClosable- Throws:
IOException
-
open
public 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.- Specified by:
openin interfaceHttpRestServer- 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.
-
getConnectionStatus
- Specified by:
getConnectionStatusin interfaceConnectionStatusAccessor
-
getHttpExceptionHandler
Retrieves theHttpExceptionHandlerfrom theHttpExceptionHandlerproperty.- Specified by:
getHttpExceptionHandlerin interfaceHttpExceptionHandlerAccessor- Returns:
- The
HttpExceptionHandlerstored by theHttpExceptionHandlerproperty.
-
setHttpExceptionHandler
Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.- Specified by:
setHttpExceptionHandlerin interfaceHttpExceptionHandlerAccessor.HttpExceptionHandlerMutator- Parameters:
aHttpErrorHandler- TheHttpExceptionHandlerto be stored by theHttpExceptionHandlerproperty.
-
getHttpExceptionHandling
Retrieves theHttpExceptionHandlingfrom theHttpExceptionHandlingproperty.- Specified by:
getHttpExceptionHandlingin interfaceHttpExceptionHandlingAccessor- Returns:
- The
HttpExceptionHandlingstored by theHttpExceptionHandlingproperty.
-
setHttpExceptionHandling
Sets theHttpExceptionHandlingfor theHttpExceptionHandlingproperty.- Specified by:
setHttpExceptionHandlingin interfaceHttpExceptionHandlingAccessor.HttpExceptionHandlingMutator- Parameters:
aHttpErrorHandling- TheHttpExceptionHandlingto be stored by theHttpExceptionHandlingproperty.
-
onConnectionRequest
- Specified by:
onConnectionRequestin interfaceHttpsConnectionRequestObservable<HttpRestServer>
-
onBasicAuthRequest
- Specified by:
onBasicAuthRequestin interfaceBasicAuthObservable<HttpRestServer>
-
setPort
public void setPort(int aPort) - Specified by:
setPortin interfacePortAccessor.PortMutator
-
getPort
public int getPort()- Specified by:
getPortin interfacePortAccessor
-
setScheme
- Specified by:
setSchemein interfaceSchemeAccessor.SchemeMutator
-
getScheme
- Specified by:
getSchemein interfaceSchemeAccessor
-
toProtocol
- Specified by:
toProtocolin interfaceSchemeAccessor
-
setProtocol
- Specified by:
setProtocolin interfaceSchemeAccessor.SchemeMutator
-
getKeyStoreDescriptor
- Specified by:
getKeyStoreDescriptorin interfaceKeyStoreDescriptorAccessor
-
setKeyStoreDescriptor
- Specified by:
setKeyStoreDescriptorin interfaceKeyStoreDescriptorAccessor.KeyStoreDescriptorMutator
-
getMaxConnections
public int getMaxConnections()- Specified by:
getMaxConnectionsin interfaceMaxConnectionsAccessor
-
setMaxConnections
public void setMaxConnections(int aMaxConnections) - Specified by:
setMaxConnectionsin interfaceMaxConnectionsAccessor.MaxConnectionsMutator
-
hasPreHttpInterceptor
- Specified by:
hasPreHttpInterceptorin interfacePreHttpInterceptable<PreHttpServerInterceptor>
-
addPreHttpInterceptor
- Specified by:
addPreHttpInterceptorin interfacePreHttpInterceptable<PreHttpServerInterceptor>
-
removePreHttpInterceptor
- Specified by:
removePreHttpInterceptorin interfacePreHttpInterceptable<PreHttpServerInterceptor>
-
hasPostHttpInterceptor
- Specified by:
hasPostHttpInterceptorin interfacePostHttpInterceptable<PostHttpServerInterceptor>
-
addPostHttpInterceptor
- Specified by:
addPostHttpInterceptorin interfacePostHttpInterceptable<PostHttpServerInterceptor>
-
removePostHttpInterceptor
- Specified by:
removePostHttpInterceptorin interfacePostHttpInterceptable<PostHttpServerInterceptor>
-
withRealm
- Specified by:
withRealmin interfaceHttpRestServer- Specified by:
withRealmin interfaceRealmAccessor.RealmBuilder<RestServer>- Specified by:
withRealmin interfaceRestServer
-
withCloseUnchecked
- Specified by:
withCloseUncheckedin interfaceClosable.CloseBuilder<ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>
-
withObserversActive
- Specified by:
withObserversActivein interfaceObservers<RestEndpoint, RestServer>- Specified by:
withObserversActivein interfaceRestServer
-
withEnableObservers
- Specified by:
withEnableObserversin interfaceObservers<RestEndpoint, RestServer>- Specified by:
withEnableObserversin interfaceRestServer
-
withDisableObservers
- Specified by:
withDisableObserversin interfaceObservers<RestEndpoint, RestServer>- Specified by:
withDisableObserversin interfaceRestServer
-
withOnHttpException
Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.- Specified by:
withOnHttpExceptionin interfaceHttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<HttpRestServer>- Parameters:
aHttpExceptionHandler- TheHttpExceptionHandlerto be stored by theHttpExceptionHandlerproperty.- Returns:
- The builder for applying multiple build operations.
-
withOpenUnchecked
-
withHttpExceptionHandler
Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.- Specified by:
withHttpExceptionHandlerin interfaceHttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<HttpRestServer>- Specified by:
withHttpExceptionHandlerin interfaceHttpRestServer- 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>- Specified by:
withHttpExceptionHandlingin interfaceHttpRestServer- Parameters:
aHttpErrorHandling- TheHttpExceptionHandlingto be stored by theHttpExceptionHandlingproperty.- Returns:
- The builder for applying multiple build operations.
-
withBaseLocator
- Specified by:
withBaseLocatorin interfaceBaseLocatorAccessor.BaseLocatorBuilder<RestServer>- Specified by:
withBaseLocatorin interfaceHttpRestServer- Specified by:
withBaseLocatorin interfaceRestServer
-
withClose
- Specified by:
withClosein interfaceClosable.CloseBuilder<ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>- Specified by:
withClosein interfaceHttpRestServer- Throws:
IOException
-
withCloseQuietly
- Specified by:
withCloseQuietlyin interfaceClosable.CloseBuilder<ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>- Specified by:
withCloseQuietlyin interfaceHttpRestServer
-
withCloseIn
- Specified by:
withCloseInin interfaceClosable.CloseBuilder<ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>- Specified by:
withCloseInin interfaceHttpRestServer
-
withOpen
- Specified by:
withOpenin interfaceConnectionOpenable.ConnectionOpenBuilder<HttpServerContext, ConnectionComponent.ConnectionComponentBuilder<HttpServerContext, HttpRestServer>>- Specified by:
withOpenin interfaceHttpRestServer- Throws:
IOException
-
withOpen
Builder method for opening theHttpRestServer. Delegates toHttpRestServer.open(int)and returns this method.- Specified by:
withOpenin interfaceHttpRestServer- 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 interfaceHttpRestServer- Specified by:
withPortin interfacePortAccessor.PortBuilder<HttpRestServer>
-
withScheme
- Specified by:
withSchemein interfaceHttpRestServer- Specified by:
withSchemein interfaceSchemeAccessor.SchemeBuilder<HttpRestServer>
-
withProtocol
- Specified by:
withProtocolin interfaceHttpRestServer- Specified by:
withProtocolin interfaceSchemeAccessor.SchemeBuilder<HttpRestServer>
-
withKeyStoreDescriptor
- Specified by:
withKeyStoreDescriptorin interfaceHttpRestServer- Specified by:
withKeyStoreDescriptorin interfaceKeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpRestServer>
-
withMaxConnections
- Specified by:
withMaxConnectionsin interfaceHttpRestServer- Specified by:
withMaxConnectionsin interfaceMaxConnectionsAccessor.MaxConnectionsBuilder<HttpRestServer>
-
preIntercept
Invoked to pre-process aHttpServerRequestalongside aHttpServerResponse.- Overrides:
preInterceptin classAbstractRestServer- Parameters:
aRequest- TheHttpServerRequestto pre-process.aResponse- TheHttpServerResponseto post-process.
-
postIntercept
Invoked to post-process aHttpServerRequestalongside aHttpServerResponse.- Overrides:
postInterceptin classAbstractRestServer- Parameters:
aRequest- TheHttpServerRequestto post-process.aResponse- TheHttpServerResponseto post-process.
-
getHttpServer
-
open
A hook to be used when using customHttpRestServer(HttpsServer) by custom open(...) methods of sub-classes of thisJdkHttpRestServer. E.gJdkHttpRestServeruses this hook to pre-configure aHttpsServerfor HTTPS. The passedHttpRestServer(HttpsServer) must already be bound to a port and enabled with the number of concurrent connections as ofHttpServer.bind(InetSocketAddress, int).- Parameters:
aHttpServer- TheHttpRestServerto be used. E.g. anHttpsServermight be used to enable HTTPS.- Throws:
IOException- in case opening with the providedHttpRestServerfails.
-