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:
JsonMediaTypeFactoryXmlMediaTypeFactoryTextMediaTypeFactoryFormMediaTypeFactory
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.BaseLocatorPropertyNested 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>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON,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>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON,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.ConnectionStatusPropertyNested classes/interfaces inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor
HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B extends HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B>>, HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator, HttpExceptionHandlerAccessor.HttpExceptionHandlerPropertyNested classes/interfaces inherited from interface org.refcodes.rest.HttpExceptionHandlingAccessor
HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B extends HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B>>, HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator, HttpExceptionHandlingAccessor.HttpExceptionHandlingPropertyNested 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.KeyStoreDescriptorPropertyNested 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.MaxConnectionsPropertyNested classes/interfaces inherited from interface org.refcodes.web.MediaTypeFactoryLookup
org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookupNested 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.OpenedPropertyNested 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.PortPropertyNested 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.RealmPropertyNested 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
FieldsFields inherited from class org.refcodes.rest.AbstractRestfulServer
_isVerbose -
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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 TypeMethodDescriptionbooleanaddPostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) booleanaddPreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) voidclose()org.refcodes.component.ConnectionStatusRetrieves theHttpExceptionHandlerfrom theHttpExceptionHandlerproperty.Retrieves theHttpExceptionHandlingfrom theHttpExceptionHandlingproperty.protected HttpServerGets the HTTP server.org.refcodes.security.KeyStoreDescriptorintintgetPort()org.refcodes.data.SchemebooleanhasPostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) booleanhasPreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) onBasicAuthRequest(org.refcodes.web.BasicAuthObserver aBasicAuthObserver) onConnectionRequest(org.refcodes.web.HttpsConnectionRequestObserver aObserver) protected voidopen(HttpServer aHttpServer) A hook to be used when using customRestfulHttpServer(HttpsServer) by custom open(...) methods of sub-classes of thisHttpRestServer.voidopen(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 voidpostIntercept(org.refcodes.web.HttpServerRequest aRequest, org.refcodes.web.HttpServerResponse aResponse) Invoked to post-process aHttpServerRequestalongside aHttpServerResponse.protected voidpreIntercept(org.refcodes.web.HttpServerRequest aRequest, org.refcodes.web.HttpServerResponse aResponse) Invoked to pre-process aHttpServerRequestalongside aHttpServerResponse.booleanremovePostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) booleanremovePreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) voidsetHttpExceptionHandler(HttpExceptionHandler aHttpErrorHandler) Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.voidsetHttpExceptionHandling(HttpExceptionHandling aHttpErrorHandling) Sets theHttpExceptionHandlingfor theHttpExceptionHandlingproperty.voidsetKeyStoreDescriptor(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor) voidsetMaxConnections(int aMaxConnections) voidsetPort(int aPort) voidsetProtocol(String aProtocol) voidsetScheme(org.refcodes.data.Scheme aScheme) withBaseLocator(String aBaseLocator) withCloseIn(int aCloseMillis) withHttpExceptionHandler(HttpExceptionHandler aHttpErrorHandler) Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.withHttpExceptionHandling(HttpExceptionHandling aHttpErrorHandling) Sets theHttpExceptionHandlingfor theHttpExceptionHandlingproperty.withKeyStoreDescriptor(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor) withMaxConnections(int aMaxConnections) withObserversActive(boolean isActive) withOnHttpException(HttpExceptionHandler aHttpExceptionHandler) Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.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, unsubscribeObserverMethods inherited from class org.refcodes.observer.AbstractObservable
clear, doHandleEventListenerException, fireEvent, getThreadPriority, hasObserver, isEmpty, setThreadPriority, sizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.web.BaseLocatorAccessor
getBaseLocatorMethods inherited from interface org.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator
setBaseLocatorMethods inherited from interface org.refcodes.web.BaseLocatorAccessor.BaseLocatorProperty
letBaseLocatorMethods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUncheckedMethods inherited from interface org.refcodes.component.ConnectionOpenable
openUncheckedMethods inherited from interface org.refcodes.component.ConnectionStatusAccessor
isOpenedMethods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
onHttpExceptionMethods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
letHttpExceptionHandlerMethods inherited from interface org.refcodes.rest.HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
letHttpExceptionHandlingMethods inherited from interface org.refcodes.web.HttpServerInterceptable
addHttpInterceptor, hasHttpInterceptor, removeHttpInterceptorMethods inherited from interface org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
letKeyStoreDescriptorMethods inherited from interface org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty
letMaxConnectionsMethods inherited from interface org.refcodes.web.MediaTypeFactoryLookup
getFactoryMediaTypes, hasMediaTypeFactory, toMediaTypeFactoryMethods inherited from interface org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
addMediaTypeFactoryMethods inherited from interface org.refcodes.observer.Observable
hasObserver, subscribeObserver, unsubscribeObserverMethods inherited from interface org.refcodes.observer.Observers
disableObservers, enableObservers, isObserversActive, observers, setObserversActiveMethods inherited from interface org.refcodes.component.Openable
openUncheckedMethods inherited from interface org.refcodes.mixin.PortAccessor.PortProperty
letPortMethods inherited from interface org.refcodes.web.RealmAccessor
getRealmMethods inherited from interface org.refcodes.web.RealmAccessor.RealmMutator
setRealmMethods inherited from interface org.refcodes.web.RealmAccessor.RealmProperty
letRealmMethods inherited from interface org.refcodes.rest.RestfulHttpServer
open, open, open, open, open, open, open, open, open, open, open, openMethods inherited from interface org.refcodes.rest.RestfulServer
onDelete, onDelete, onGet, onGet, onPost, onPost, onPut, onPut, onRequest, onRequest, onRequest, onRequest, onRequestMethods 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 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 constructorHttpRestServer(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).
-
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 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 constructorHttpRestServer(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.
-
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 defaultExecutorServiceas 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 defaultExecutorServiceas 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 creatingThreads.
-
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 creatingThreads.isVerbose- When true, any unknown content- and accept-types are logged.
-
-
Method Details
-
close
- Specified by:
closein 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:
openin interfaceRestfulHttpServer- 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
public org.refcodes.component.ConnectionStatus getConnectionStatus()- Specified by:
getConnectionStatusin interfaceorg.refcodes.component.ConnectionStatusAccessor
-
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
public RestfulHttpServer onConnectionRequest(org.refcodes.web.HttpsConnectionRequestObserver aObserver) - Specified by:
onConnectionRequestin interfaceorg.refcodes.web.HttpsConnectionRequestObservable<RestfulHttpServer>
-
onBasicAuthRequest
- Specified by:
onBasicAuthRequestin interfaceorg.refcodes.web.BasicAuthObservable<RestfulHttpServer>
-
setPort
public void setPort(int aPort) - Specified by:
setPortin interfaceorg.refcodes.mixin.PortAccessor.PortMutator
-
getPort
public int getPort()- Specified by:
getPortin interfaceorg.refcodes.mixin.PortAccessor
-
setScheme
public void setScheme(org.refcodes.data.Scheme aScheme) - Specified by:
setSchemein interfaceorg.refcodes.web.SchemeAccessor.SchemeMutator
-
getScheme
public org.refcodes.data.Scheme getScheme()- Specified by:
getSchemein interfaceorg.refcodes.web.SchemeAccessor
-
toProtocol
- Specified by:
toProtocolin interfaceorg.refcodes.web.SchemeAccessor
-
setProtocol
- Specified by:
setProtocolin interfaceorg.refcodes.web.SchemeAccessor.SchemeMutator
-
getKeyStoreDescriptor
public org.refcodes.security.KeyStoreDescriptor getKeyStoreDescriptor()- Specified by:
getKeyStoreDescriptorin interfaceorg.refcodes.security.KeyStoreDescriptorAccessor
-
setKeyStoreDescriptor
public void setKeyStoreDescriptor(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor) - Specified by:
setKeyStoreDescriptorin interfaceorg.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator
-
getMaxConnections
public int getMaxConnections()- Specified by:
getMaxConnectionsin interfaceorg.refcodes.io.MaxConnectionsAccessor
-
setMaxConnections
public void setMaxConnections(int aMaxConnections) - Specified by:
setMaxConnectionsin interfaceorg.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator
-
hasPreHttpInterceptor
public boolean hasPreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) - Specified by:
hasPreHttpInterceptorin interfaceorg.refcodes.web.PreHttpInterceptable<org.refcodes.web.PreHttpServerInterceptor>
-
addPreHttpInterceptor
public boolean addPreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) - Specified by:
addPreHttpInterceptorin interfaceorg.refcodes.web.PreHttpInterceptable<org.refcodes.web.PreHttpServerInterceptor>
-
removePreHttpInterceptor
public boolean removePreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) - Specified by:
removePreHttpInterceptorin interfaceorg.refcodes.web.PreHttpInterceptable<org.refcodes.web.PreHttpServerInterceptor>
-
hasPostHttpInterceptor
public boolean hasPostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) - Specified by:
hasPostHttpInterceptorin interfaceorg.refcodes.web.PostHttpInterceptable<org.refcodes.web.PostHttpServerInterceptor>
-
addPostHttpInterceptor
public boolean addPostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) - Specified by:
addPostHttpInterceptorin interfaceorg.refcodes.web.PostHttpInterceptable<org.refcodes.web.PostHttpServerInterceptor>
-
removePostHttpInterceptor
public boolean removePostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) - Specified by:
removePostHttpInterceptorin interfaceorg.refcodes.web.PostHttpInterceptable<org.refcodes.web.PostHttpServerInterceptor>
-
withRealm
- Specified by:
withRealmin interfaceorg.refcodes.web.RealmAccessor.RealmBuilder<RestfulServer>- Specified by:
withRealmin interfaceRestfulHttpServer- Specified by:
withRealmin interfaceRestfulServer
-
withCloseUnchecked
- Specified by:
withCloseUncheckedin interfaceorg.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,RestfulHttpServer>>
-
withObserversActive
- Specified by:
withObserversActivein interfaceorg.refcodes.observer.Observers<RestEndpoint,RestfulServer> - Specified by:
withObserversActivein interfaceRestfulServer
-
withEnableObservers
- Specified by:
withEnableObserversin interfaceorg.refcodes.observer.Observers<RestEndpoint,RestfulServer> - Specified by:
withEnableObserversin interfaceRestfulServer
-
withDisableObservers
- Specified by:
withDisableObserversin interfaceorg.refcodes.observer.Observers<RestEndpoint,RestfulServer> - Specified by:
withDisableObserversin interfaceRestfulServer
-
withOnHttpException
Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.- Specified by:
withOnHttpExceptionin interfaceHttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<RestfulHttpServer>- Parameters:
aHttpExceptionHandler- TheHttpExceptionHandlerto be stored by theHttpExceptionHandlerproperty.- Returns:
- The builder for applying multiple build operations.
-
withOpenUnchecked
- Specified by:
withOpenUncheckedin interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext, RestfulHttpServer>>
-
withHttpExceptionHandler
Sets theHttpExceptionHandlerfor theHttpExceptionHandlerproperty.- Specified by:
withHttpExceptionHandlerin interfaceHttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<RestfulHttpServer>- Specified by:
withHttpExceptionHandlerin interfaceRestfulHttpServer- Parameters:
aHttpErrorHandler- TheHttpExceptionHandlerto be stored by theHttpExceptionHandlerproperty.- Returns:
- The builder for applying multiple build operations.
-
withHttpExceptionHandling
Sets theHttpExceptionHandlingfor theHttpExceptionHandlingproperty.- Specified by:
withHttpExceptionHandlingin interfaceHttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<RestfulHttpServer>- Specified by:
withHttpExceptionHandlingin interfaceRestfulHttpServer- Parameters:
aHttpErrorHandling- TheHttpExceptionHandlingto be stored by theHttpExceptionHandlingproperty.- Returns:
- The builder for applying multiple build operations.
-
withBaseLocator
- Specified by:
withBaseLocatorin interfaceorg.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<RestfulServer>- Specified by:
withBaseLocatorin interfaceRestfulHttpServer- Specified by:
withBaseLocatorin interfaceRestfulServer
-
withClose
- Specified by:
withClosein interfaceorg.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,RestfulHttpServer>> - Specified by:
withClosein interfaceRestfulHttpServer- Throws:
IOException
-
withCloseQuietly
- Specified by:
withCloseQuietlyin interfaceorg.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,RestfulHttpServer>> - Specified by:
withCloseQuietlyin interfaceRestfulHttpServer
-
withCloseIn
- Specified by:
withCloseInin interfaceorg.refcodes.component.Closable.CloseBuilder<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,RestfulHttpServer>> - Specified by:
withCloseInin interfaceRestfulHttpServer
-
withOpen
- Specified by:
withOpenin interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext, RestfulHttpServer>> - Specified by:
withOpenin interfaceRestfulHttpServer- Throws:
IOException
-
withOpen
Builder method for opening theRestfulHttpServer. Delegates toRestfulHttpServer.open(int)and returns this method.- Specified by:
withOpenin 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:
withPortin interfaceorg.refcodes.mixin.PortAccessor.PortBuilder<RestfulHttpServer>- Specified by:
withPortin interfaceRestfulHttpServer
-
withScheme
- Specified by:
withSchemein interfaceRestfulHttpServer- Specified by:
withSchemein interfaceorg.refcodes.web.SchemeAccessor.SchemeBuilder<RestfulHttpServer>
-
withProtocol
- Specified by:
withProtocolin interfaceRestfulHttpServer- Specified by:
withProtocolin interfaceorg.refcodes.web.SchemeAccessor.SchemeBuilder<RestfulHttpServer>
-
withKeyStoreDescriptor
public HttpRestServer withKeyStoreDescriptor(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor) - Specified by:
withKeyStoreDescriptorin interfaceorg.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<RestfulHttpServer>- Specified by:
withKeyStoreDescriptorin interfaceRestfulHttpServer
-
withMaxConnections
- Specified by:
withMaxConnectionsin interfaceorg.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<RestfulHttpServer>- Specified by:
withMaxConnectionsin interfaceRestfulHttpServer
-
preIntercept
protected void preIntercept(org.refcodes.web.HttpServerRequest aRequest, org.refcodes.web.HttpServerResponse aResponse) Invoked to pre-process aHttpServerRequestalongside aHttpServerResponse.- Overrides:
preInterceptin classAbstractRestfulServer- Parameters:
aRequest- TheHttpServerRequestto pre-process.aResponse- TheHttpServerResponseto post-process.
-
postIntercept
protected void postIntercept(org.refcodes.web.HttpServerRequest aRequest, org.refcodes.web.HttpServerResponse aResponse) Invoked to post-process aHttpServerRequestalongside aHttpServerResponse.- Overrides:
postInterceptin classAbstractRestfulServer- Parameters:
aRequest- TheHttpServerRequestto post-process.aResponse- TheHttpServerResponseto post-process.
-
getHttpServer
-
open
A hook to be used when using customRestfulHttpServer(HttpsServer) by custom open(...) methods of sub-classes of thisHttpRestServer. E.gHttpRestServeruses this hook to pre-configure aHttpsServerfor 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- TheRestfulHttpServerto be used. E.g. anHttpsServermight be used to enable HTTPS.- Throws:
IOException- in case opening with the providedRestfulHttpServerfails.
-