java.lang.Object
org.refcodes.observer.AbstractObservable<RestEndpoint,org.refcodes.web.HttpRequest>
org.refcodes.rest.AbstractRestfulServer
org.refcodes.rest.HttpRestServer
- All Implemented Interfaces:
org.refcodes.component.Closable
,org.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,
,RestfulHttpServer>> org.refcodes.component.ConnectionComponent<org.refcodes.web.HttpServerContext>
,org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,
,RestfulHttpServer> org.refcodes.component.ConnectionOpenable<org.refcodes.web.HttpServerContext>
,org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,
,org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext, RestfulHttpServer>> org.refcodes.component.ConnectionStatusAccessor
,org.refcodes.component.LinkComponent
,org.refcodes.component.Openable
,org.refcodes.component.OpenedAccessor
,org.refcodes.io.MaxConnectionsAccessor
,org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<RestfulHttpServer>
,org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator
,org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty
,org.refcodes.mixin.Disposable
,org.refcodes.mixin.PortAccessor
,org.refcodes.mixin.PortAccessor.PortBuilder<RestfulHttpServer>
,org.refcodes.mixin.PortAccessor.PortMutator
,org.refcodes.mixin.PortAccessor.PortProperty
,org.refcodes.observer.Observable<RestEndpoint>
,org.refcodes.observer.Observers<RestEndpoint,
,RestfulServer> HttpExceptionHandlerAccessor
,HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<RestfulHttpServer>
,HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
,HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
,HttpExceptionHandlingAccessor
,HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<RestfulHttpServer>
,HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator
,HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
,RestfulHttpServer
,RestfulServer
,org.refcodes.security.KeyStoreDescriptorAccessor
,org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<RestfulHttpServer>
,org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator
,org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
,org.refcodes.web.BaseLocatorAccessor
,org.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<RestfulServer>
,org.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator
,org.refcodes.web.BaseLocatorAccessor.BaseLocatorProperty
,org.refcodes.web.BasicAuthObservable<RestfulHttpServer>
,org.refcodes.web.HttpsConnectionRequestObservable<RestfulHttpServer>
,org.refcodes.web.HttpServerInterceptable
,org.refcodes.web.MediaTypeFactoryLookup
,org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
,org.refcodes.web.PostHttpInterceptable<org.refcodes.web.PostHttpServerInterceptor>
,org.refcodes.web.PostHttpServerInterceptable
,org.refcodes.web.PreHttpInterceptable<org.refcodes.web.PreHttpServerInterceptor>
,org.refcodes.web.PreHttpServerInterceptable
,org.refcodes.web.RealmAccessor
,org.refcodes.web.RealmAccessor.RealmBuilder<RestfulServer>
,org.refcodes.web.RealmAccessor.RealmMutator
,org.refcodes.web.RealmAccessor.RealmProperty
,org.refcodes.web.SchemeAccessor
,org.refcodes.web.SchemeAccessor.SchemeBuilder<RestfulHttpServer>
,org.refcodes.web.SchemeAccessor.SchemeMutator
,org.refcodes.web.SchemeAccessor.SchemeProperty
- Direct Known Subclasses:
HttpRestServerSingleton
Implementation of the
RestfulHttpServer
interface using the
RestfulHttpServer
defined in the com.sun.net.httpserver
package. The HttpRestServer
is being initialized with some common
MediaTypeFactory
instances (as implemented by the
AbstractRestfulServer
). At the time of writing this document the
MediaTypeFactory
instances being preconfigured are:
JsonMediaTypeFactory
XmlMediaTypeFactory
TextMediaTypeFactory
FormMediaTypeFactory
HttpRestServer
supports HTTP as well as HTTPS protocols as being
based on the RestfulHttpServer
as well as on the HttpsServer
.
For opening up an HTTPS connection, refer to the methods such as
RestfulHttpServer.open(String, KeyStoreDescriptor, int)
or
RestfulHttpServer.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.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.web.BaseLocatorAccessor
org.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<B extends org.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<B>>, org.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator, org.refcodes.web.BaseLocatorAccessor.BaseLocatorProperty
Nested classes/interfaces inherited from interface org.refcodes.component.Closable
org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionComponent
org.refcodes.component.ConnectionComponent.ConnectionAutomaton<CON extends Object>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON extends Object,
B extends org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON, B>> Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionOpenable
org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<CON extends Object>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON extends Object,
B extends org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON, B>> Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
Nested classes/interfaces inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor
HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B extends HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B>>, HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator, HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
Nested classes/interfaces inherited from interface org.refcodes.rest.HttpExceptionHandlingAccessor
HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B extends HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B>>, HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator, HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
Nested classes/interfaces inherited from interface org.refcodes.security.KeyStoreDescriptorAccessor
org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<B extends org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<B>>, org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator, org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
Nested classes/interfaces inherited from interface org.refcodes.component.LinkComponent
org.refcodes.component.LinkComponent.LinkAutomaton, org.refcodes.component.LinkComponent.LinkComponentBuilder<B extends org.refcodes.component.LinkComponent.LinkComponentBuilder<B>>
Nested classes/interfaces inherited from interface org.refcodes.io.MaxConnectionsAccessor
org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<B extends org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<B>>, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator, org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty
Nested classes/interfaces inherited from interface org.refcodes.web.MediaTypeFactoryLookup
org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
Nested classes/interfaces inherited from interface org.refcodes.component.Openable
org.refcodes.component.Openable.OpenAutomaton, org.refcodes.component.Openable.OpenBuilder<B extends org.refcodes.component.Openable.OpenBuilder<B>>
Nested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor
org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
Nested classes/interfaces inherited from interface org.refcodes.mixin.PortAccessor
org.refcodes.mixin.PortAccessor.PortBuilder<B extends org.refcodes.mixin.PortAccessor.PortBuilder<B>>, org.refcodes.mixin.PortAccessor.PortMutator, org.refcodes.mixin.PortAccessor.PortProperty
Nested classes/interfaces inherited from interface org.refcodes.web.RealmAccessor
org.refcodes.web.RealmAccessor.RealmBuilder<B extends org.refcodes.web.RealmAccessor.RealmBuilder<B>>, org.refcodes.web.RealmAccessor.RealmMutator, org.refcodes.web.RealmAccessor.RealmProperty
Nested classes/interfaces inherited from interface org.refcodes.web.SchemeAccessor
org.refcodes.web.SchemeAccessor.SchemeBuilder<B extends org.refcodes.web.SchemeAccessor.SchemeBuilder<B>>, org.refcodes.web.SchemeAccessor.SchemeMutator, org.refcodes.web.SchemeAccessor.SchemeProperty
-
Field Summary
Fields inherited from class org.refcodes.rest.AbstractRestfulServer
_isVerbose
-
Constructor Summary
ConstructorDescriptionConstructs aHttpRestServer
.HttpRestServer
(boolean isVerbose) Constructs aHttpRestServer
.HttpRestServer
(ExecutorService aExecutorService) Constructs aHttpRestServer
.HttpRestServer
(ExecutorService aExecutorService, boolean isVerbose) Constructs aHttpRestServer
.HttpRestServer
(org.refcodes.controlflow.ThreadingModel aThreadingModel) Constructs aHttpRestServer
.HttpRestServer
(org.refcodes.controlflow.ThreadingModel aThreadingModel, boolean isVerbose) Constructs aHttpRestServer
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addPostHttpInterceptor
(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) boolean
addPreHttpInterceptor
(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) void
close()
org.refcodes.component.ConnectionStatus
Retrieves theHttpExceptionHandler
from theHttpExceptionHandler
property.Retrieves theHttpExceptionHandling
from theHttpExceptionHandling
property.protected HttpServer
Gets the HTTP server.org.refcodes.security.KeyStoreDescriptor
int
int
getPort()
org.refcodes.data.Scheme
boolean
hasPostHttpInterceptor
(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) boolean
hasPreHttpInterceptor
(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) onBasicAuthRequest
(org.refcodes.web.BasicAuthObserver aBasicAuthObserver) onConnectionRequest
(org.refcodes.web.HttpsConnectionRequestObserver aObserver) protected void
open
(HttpServer aHttpServer) A hook to be used when using customRestfulHttpServer
(HttpsServer
) by custom open(...) methods of sub-classes of thisHttpRestServer
.void
open
(String aProtocol, org.refcodes.security.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 void
postIntercept
(org.refcodes.web.HttpServerRequest aRequest, org.refcodes.web.HttpServerResponse aResponse) Invoked to post-process aHttpServerRequest
alongside aHttpServerResponse
.protected void
preIntercept
(org.refcodes.web.HttpServerRequest aRequest, org.refcodes.web.HttpServerResponse aResponse) Invoked to pre-process aHttpServerRequest
alongside aHttpServerResponse
.boolean
removePostHttpInterceptor
(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) boolean
removePreHttpInterceptor
(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) void
setHttpExceptionHandler
(HttpExceptionHandler aHttpErrorHandler) Sets theHttpExceptionHandler
for theHttpExceptionHandler
property.void
setHttpExceptionHandling
(HttpExceptionHandling aHttpErrorHandling) Sets theHttpExceptionHandling
for theHttpExceptionHandling
property.void
setKeyStoreDescriptor
(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor) void
setMaxConnections
(int aMaxConnections) void
setPort
(int aPort) void
setProtocol
(String aProtocol) void
setScheme
(org.refcodes.data.Scheme aScheme) withBaseLocator
(String aBaseLocator) withCloseIn
(int aCloseMillis) withHttpExceptionHandler
(HttpExceptionHandler aHttpErrorHandler) Sets theHttpExceptionHandler
for theHttpExceptionHandler
property.withHttpExceptionHandling
(HttpExceptionHandling aHttpErrorHandling) Sets theHttpExceptionHandling
for theHttpExceptionHandling
property.withKeyStoreDescriptor
(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor) withMaxConnections
(int aMaxConnections) withObserversActive
(boolean isActive) withOnHttpException
(HttpExceptionHandler aHttpExceptionHandler) Sets theHttpExceptionHandler
for theHttpExceptionHandler
property.withOpen
(int aPort) Builder method for opening theRestfulHttpServer
.withOpen
(org.refcodes.web.HttpServerContext aConnection) withOpenUnchecked
(org.refcodes.web.HttpServerContext aConnection) withPort
(int aPort) withProtocol
(String aProtocol) withScheme
(org.refcodes.data.Scheme aScheme) Methods inherited from class org.refcodes.rest.AbstractRestfulServer
addMediaTypeFactory, dispose, fireEvent, getBaseLocator, getFactoryMediaTypes, getRealm, initMedaTypeFactories, isObserversActive, observers, onHttpRequest, setBaseLocator, setObserversActive, setRealm, subscribeObserver, toMediaTypeFactory, toNegotiatedContenType, toResponseBody, unsubscribeObserver
Methods inherited from class org.refcodes.observer.AbstractObservable
clear, doHandleEventListenerException, fireEvent, getThreadPriority, hasObserver, isEmpty, setThreadPriority, size
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.refcodes.web.BaseLocatorAccessor
getBaseLocator
Methods inherited from interface org.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator
setBaseLocator
Methods inherited from interface org.refcodes.web.BaseLocatorAccessor.BaseLocatorProperty
letBaseLocator
Methods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUnchecked
Methods inherited from interface org.refcodes.component.ConnectionOpenable
openUnchecked
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
isOpened
Methods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
onHttpException
Methods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
letHttpExceptionHandler
Methods inherited from interface org.refcodes.rest.HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
letHttpExceptionHandling
Methods inherited from interface org.refcodes.web.HttpServerInterceptable
addHttpInterceptor, hasHttpInterceptor, removeHttpInterceptor
Methods inherited from interface org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
letKeyStoreDescriptor
Methods inherited from interface org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty
letMaxConnections
Methods inherited from interface org.refcodes.web.MediaTypeFactoryLookup
getFactoryMediaTypes, hasMediaTypeFactory, toMediaTypeFactory
Methods inherited from interface org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
addMediaTypeFactory
Methods inherited from interface org.refcodes.observer.Observable
hasObserver, subscribeObserver, unsubscribeObserver
Methods inherited from interface org.refcodes.observer.Observers
disableObservers, enableObservers, isObserversActive, observers, setObserversActive
Methods inherited from interface org.refcodes.component.Openable
openUnchecked
Methods inherited from interface org.refcodes.mixin.PortAccessor.PortProperty
letPort
Methods inherited from interface org.refcodes.web.RealmAccessor
getRealm
Methods inherited from interface org.refcodes.web.RealmAccessor.RealmMutator
setRealm
Methods inherited from interface org.refcodes.web.RealmAccessor.RealmProperty
letRealm
Methods inherited from interface org.refcodes.rest.RestfulHttpServer
open, open, open, open, open, open, open, open, open, open, open, open
Methods inherited from interface org.refcodes.rest.RestfulServer
onDelete, onDelete, onGet, onGet, onPost, onPost, onPut, onPut, onRequest, onRequest, onRequest, onRequest, onRequest
Methods inherited from interface org.refcodes.web.SchemeAccessor.SchemeProperty
letProtocol, letScheme
-
Field Details
-
CONTEXT_PATH
-
-
Constructor Details
-
HttpRestServer
public HttpRestServer(org.refcodes.controlflow.ThreadingModel aThreadingModel) Constructs aHttpRestServer
. UseRestfulHttpServer.open(int)
or similar to make it listen on your port. The providedThreadingModel
defines 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 constructorHttpRestServer(ExecutorService)
.- Parameters:
aThreadingModel
- Specifies to either use a single-threaded threading model (noExecutorService
) or a multi-threaded threading model with a defaultExecutorService
as ofControlFlowUtility.createCachedExecutorService(boolean)
.
-
HttpRestServer
public HttpRestServer(org.refcodes.controlflow.ThreadingModel aThreadingModel, boolean isVerbose) Constructs aHttpRestServer
. UseRestfulHttpServer.open(int)
or similar to make it listen on your port. The providedThreadingModel
defines 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 constructorHttpRestServer(ExecutorService)
.- Parameters:
aThreadingModel
- Specifies to either use a single-threaded threading model (noExecutorService
) or a multi-threaded threading model with a defaultExecutorService
as ofControlFlowUtility.createCachedExecutorService(boolean)
.isVerbose
- When true, any unknown content- and accept-types are logged.
-
HttpRestServer
public HttpRestServer()Constructs aHttpRestServer
. UseRestfulHttpServer.open(int)
or similar to make it listen on your port. Uses a multi threaded threading model with a defaultExecutorService
as ofControlFlowUtility.createCachedExecutorService(boolean)
. Threads are created as daemon threads. For more control on thread generation use the constructorHttpRestServer(ExecutorService)
. -
HttpRestServer
public HttpRestServer(boolean isVerbose) Constructs aHttpRestServer
. UseRestfulHttpServer.open(int)
or similar to make it listen on your port. Uses a multi threaded threading model with a defaultExecutorService
as ofControlFlowUtility.createCachedExecutorService(boolean)
. Threads are created as daemon threads. For more control on thread generation use the constructorHttpRestServer(ExecutorService)
.- Parameters:
isVerbose
- When true, any unknown content- and accept-types are logged.
-
HttpRestServer
Constructs aHttpRestServer
. UseRestfulHttpServer.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 creatingThread
s.
-
HttpRestServer
Constructs aHttpRestServer
. UseRestfulHttpServer.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 creatingThread
s.isVerbose
- When true, any unknown content- and accept-types are logged.
-
-
Method Details
-
close
- Specified by:
close
in interfaceorg.refcodes.component.Closable
- Throws:
IOException
-
open
public void open(String aProtocol, org.refcodes.security.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:
open
in interfaceRestfulHttpServer
- Parameters:
aProtocol
- The protocol to use, e.g. "TLS".aStoreDescriptor
- The store descriptor describing yourKeyStore
required 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
public org.refcodes.component.ConnectionStatus getConnectionStatus()- Specified by:
getConnectionStatus
in interfaceorg.refcodes.component.ConnectionStatusAccessor
-
getHttpExceptionHandler
Retrieves theHttpExceptionHandler
from theHttpExceptionHandler
property.- Specified by:
getHttpExceptionHandler
in interfaceHttpExceptionHandlerAccessor
- Returns:
- The
HttpExceptionHandler
stored by theHttpExceptionHandler
property.
-
setHttpExceptionHandler
Sets theHttpExceptionHandler
for theHttpExceptionHandler
property.- Specified by:
setHttpExceptionHandler
in interfaceHttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
- Parameters:
aHttpErrorHandler
- TheHttpExceptionHandler
to be stored by theHttpExceptionHandler
property.
-
getHttpExceptionHandling
Retrieves theHttpExceptionHandling
from theHttpExceptionHandling
property.- Specified by:
getHttpExceptionHandling
in interfaceHttpExceptionHandlingAccessor
- Returns:
- The
HttpExceptionHandling
stored by theHttpExceptionHandling
property.
-
setHttpExceptionHandling
Sets theHttpExceptionHandling
for theHttpExceptionHandling
property.- Specified by:
setHttpExceptionHandling
in interfaceHttpExceptionHandlingAccessor.HttpExceptionHandlingMutator
- Parameters:
aHttpErrorHandling
- TheHttpExceptionHandling
to be stored by theHttpExceptionHandling
property.
-
onConnectionRequest
public RestfulHttpServer onConnectionRequest(org.refcodes.web.HttpsConnectionRequestObserver aObserver) - Specified by:
onConnectionRequest
in interfaceorg.refcodes.web.HttpsConnectionRequestObservable<RestfulHttpServer>
-
onBasicAuthRequest
- Specified by:
onBasicAuthRequest
in interfaceorg.refcodes.web.BasicAuthObservable<RestfulHttpServer>
-
setPort
public void setPort(int aPort) - Specified by:
setPort
in interfaceorg.refcodes.mixin.PortAccessor.PortMutator
-
getPort
public int getPort()- Specified by:
getPort
in interfaceorg.refcodes.mixin.PortAccessor
-
setScheme
public void setScheme(org.refcodes.data.Scheme aScheme) - Specified by:
setScheme
in interfaceorg.refcodes.web.SchemeAccessor.SchemeMutator
-
getScheme
public org.refcodes.data.Scheme getScheme()- Specified by:
getScheme
in interfaceorg.refcodes.web.SchemeAccessor
-
toProtocol
- Specified by:
toProtocol
in interfaceorg.refcodes.web.SchemeAccessor
-
setProtocol
- Specified by:
setProtocol
in interfaceorg.refcodes.web.SchemeAccessor.SchemeMutator
-
getKeyStoreDescriptor
public org.refcodes.security.KeyStoreDescriptor getKeyStoreDescriptor()- Specified by:
getKeyStoreDescriptor
in interfaceorg.refcodes.security.KeyStoreDescriptorAccessor
-
setKeyStoreDescriptor
public void setKeyStoreDescriptor(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor) - Specified by:
setKeyStoreDescriptor
in interfaceorg.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator
-
getMaxConnections
public int getMaxConnections()- Specified by:
getMaxConnections
in interfaceorg.refcodes.io.MaxConnectionsAccessor
-
setMaxConnections
public void setMaxConnections(int aMaxConnections) - Specified by:
setMaxConnections
in interfaceorg.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator
-
hasPreHttpInterceptor
public boolean hasPreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) - Specified by:
hasPreHttpInterceptor
in interfaceorg.refcodes.web.PreHttpInterceptable<org.refcodes.web.PreHttpServerInterceptor>
-
addPreHttpInterceptor
public boolean addPreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) - Specified by:
addPreHttpInterceptor
in interfaceorg.refcodes.web.PreHttpInterceptable<org.refcodes.web.PreHttpServerInterceptor>
-
removePreHttpInterceptor
public boolean removePreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) - Specified by:
removePreHttpInterceptor
in interfaceorg.refcodes.web.PreHttpInterceptable<org.refcodes.web.PreHttpServerInterceptor>
-
hasPostHttpInterceptor
public boolean hasPostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) - Specified by:
hasPostHttpInterceptor
in interfaceorg.refcodes.web.PostHttpInterceptable<org.refcodes.web.PostHttpServerInterceptor>
-
addPostHttpInterceptor
public boolean addPostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) - Specified by:
addPostHttpInterceptor
in interfaceorg.refcodes.web.PostHttpInterceptable<org.refcodes.web.PostHttpServerInterceptor>
-
removePostHttpInterceptor
public boolean removePostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) - Specified by:
removePostHttpInterceptor
in interfaceorg.refcodes.web.PostHttpInterceptable<org.refcodes.web.PostHttpServerInterceptor>
-
withRealm
- Specified by:
withRealm
in interfaceorg.refcodes.web.RealmAccessor.RealmBuilder<RestfulServer>
- Specified by:
withRealm
in interfaceRestfulHttpServer
- Specified by:
withRealm
in interfaceRestfulServer
-
withCloseUnchecked
- Specified by:
withCloseUnchecked
in interfaceorg.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,
RestfulHttpServer>>
-
withObserversActive
- Specified by:
withObserversActive
in interfaceorg.refcodes.observer.Observers<RestEndpoint,
RestfulServer> - Specified by:
withObserversActive
in interfaceRestfulServer
-
withEnableObservers
- Specified by:
withEnableObservers
in interfaceorg.refcodes.observer.Observers<RestEndpoint,
RestfulServer> - Specified by:
withEnableObservers
in interfaceRestfulServer
-
withDisableObservers
- Specified by:
withDisableObservers
in interfaceorg.refcodes.observer.Observers<RestEndpoint,
RestfulServer> - Specified by:
withDisableObservers
in interfaceRestfulServer
-
withOnHttpException
Sets theHttpExceptionHandler
for theHttpExceptionHandler
property.- Specified by:
withOnHttpException
in interfaceHttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<RestfulHttpServer>
- Parameters:
aHttpExceptionHandler
- TheHttpExceptionHandler
to be stored by theHttpExceptionHandler
property.- Returns:
- The builder for applying multiple build operations.
-
withOpenUnchecked
- Specified by:
withOpenUnchecked
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,
org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext, RestfulHttpServer>>
-
withHttpExceptionHandler
Sets theHttpExceptionHandler
for theHttpExceptionHandler
property.- Specified by:
withHttpExceptionHandler
in interfaceHttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<RestfulHttpServer>
- Specified by:
withHttpExceptionHandler
in interfaceRestfulHttpServer
- Parameters:
aHttpErrorHandler
- TheHttpExceptionHandler
to be stored by theHttpExceptionHandler
property.- Returns:
- The builder for applying multiple build operations.
-
withHttpExceptionHandling
Sets theHttpExceptionHandling
for theHttpExceptionHandling
property.- Specified by:
withHttpExceptionHandling
in interfaceHttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<RestfulHttpServer>
- Specified by:
withHttpExceptionHandling
in interfaceRestfulHttpServer
- Parameters:
aHttpErrorHandling
- TheHttpExceptionHandling
to be stored by theHttpExceptionHandling
property.- Returns:
- The builder for applying multiple build operations.
-
withBaseLocator
- Specified by:
withBaseLocator
in interfaceorg.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<RestfulServer>
- Specified by:
withBaseLocator
in interfaceRestfulHttpServer
- Specified by:
withBaseLocator
in interfaceRestfulServer
-
withClose
- Specified by:
withClose
in interfaceorg.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,
RestfulHttpServer>> - Specified by:
withClose
in interfaceRestfulHttpServer
- Throws:
IOException
-
withCloseQuietly
- Specified by:
withCloseQuietly
in interfaceorg.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,
RestfulHttpServer>> - Specified by:
withCloseQuietly
in interfaceRestfulHttpServer
-
withCloseIn
- Specified by:
withCloseIn
in interfaceorg.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,
RestfulHttpServer>> - Specified by:
withCloseIn
in interfaceRestfulHttpServer
-
withOpen
- Specified by:
withOpen
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,
org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext, RestfulHttpServer>> - Specified by:
withOpen
in interfaceRestfulHttpServer
- Throws:
IOException
-
withOpen
Builder method for opening theRestfulHttpServer
. Delegates toRestfulHttpServer.open(int)
and returns this method.- Specified by:
withOpen
in interfaceRestfulHttpServer
- 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:
withPort
in interfaceorg.refcodes.mixin.PortAccessor.PortBuilder<RestfulHttpServer>
- Specified by:
withPort
in interfaceRestfulHttpServer
-
withScheme
- Specified by:
withScheme
in interfaceRestfulHttpServer
- Specified by:
withScheme
in interfaceorg.refcodes.web.SchemeAccessor.SchemeBuilder<RestfulHttpServer>
-
withProtocol
- Specified by:
withProtocol
in interfaceRestfulHttpServer
- Specified by:
withProtocol
in interfaceorg.refcodes.web.SchemeAccessor.SchemeBuilder<RestfulHttpServer>
-
withKeyStoreDescriptor
public HttpRestServer withKeyStoreDescriptor(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor) - Specified by:
withKeyStoreDescriptor
in interfaceorg.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<RestfulHttpServer>
- Specified by:
withKeyStoreDescriptor
in interfaceRestfulHttpServer
-
withMaxConnections
- Specified by:
withMaxConnections
in interfaceorg.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<RestfulHttpServer>
- Specified by:
withMaxConnections
in interfaceRestfulHttpServer
-
preIntercept
protected void preIntercept(org.refcodes.web.HttpServerRequest aRequest, org.refcodes.web.HttpServerResponse aResponse) Invoked to pre-process aHttpServerRequest
alongside aHttpServerResponse
.- Overrides:
preIntercept
in classAbstractRestfulServer
- Parameters:
aRequest
- TheHttpServerRequest
to pre-process.aResponse
- TheHttpServerResponse
to post-process.
-
postIntercept
protected void postIntercept(org.refcodes.web.HttpServerRequest aRequest, org.refcodes.web.HttpServerResponse aResponse) Invoked to post-process aHttpServerRequest
alongside aHttpServerResponse
.- Overrides:
postIntercept
in classAbstractRestfulServer
- Parameters:
aRequest
- TheHttpServerRequest
to post-process.aResponse
- TheHttpServerResponse
to post-process.
-
getHttpServer
Gets the HTTP server.- Returns:
- the HTTP server
-
open
A hook to be used when using customRestfulHttpServer
(HttpsServer
) by custom open(...) methods of sub-classes of thisHttpRestServer
. E.gHttpRestServer
uses this hook to pre-configure aHttpsServer
for HTTPS. The passedRestfulHttpServer
(HttpsServer
) must already be bound to a port and enabled with the number of concurrent connections as ofHttpServer.bind(InetSocketAddress, int)
.- Parameters:
aHttpServer
- TheRestfulHttpServer
to be used. E.g. anHttpsServer
might be used to enable HTTPS.- Throws:
IOException
- in case opening with the providedRestfulHttpServer
fails.
-