Package org.refcodes.rest
Class AbstractHttpRestServerDecorator<B extends HttpRestServer>
- java.lang.Object
-
- org.refcodes.rest.AbstractHttpRestServerDecorator<B>
-
- All Implemented Interfaces:
org.refcodes.component.Closable
,org.refcodes.component.Closable.CloseBuilder<B>
,org.refcodes.component.ConnectionComponent<B>
,org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.net.HttpServerContext,HttpRestServer>
,org.refcodes.component.ConnectionOpenable<B>
,org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<RestEndpoint,RestServer>
,org.refcodes.component.ConnectionStatusAccessor
,org.refcodes.component.LinkComponent
,org.refcodes.component.Openable
,org.refcodes.io.MaxConnectionsAccessor
,org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsBuilder<B>
,org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator
,org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty
,org.refcodes.mixin.PortAccessor
,org.refcodes.mixin.PortAccessor.PortBuilder<B>
,org.refcodes.mixin.PortAccessor.PortMutator
,org.refcodes.mixin.PortAccessor.PortProperty
,org.refcodes.net.BaseLocatorAccessor
,org.refcodes.net.BaseLocatorAccessor.BaseLocatorBuilder<B>
,org.refcodes.net.BaseLocatorAccessor.BaseLocatorMutator
,org.refcodes.net.BaseLocatorAccessor.BaseLocatorProperty
,org.refcodes.net.BasicAuthObservable<B>
,org.refcodes.net.HttpsConnectionRequestObservable<B>
,org.refcodes.net.MediaTypeFactoryLookup
,org.refcodes.net.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
,org.refcodes.net.RealmAccessor
,org.refcodes.net.RealmAccessor.RealmBuilder<B>
,org.refcodes.net.RealmAccessor.RealmMutator
,org.refcodes.net.RealmAccessor.RealmProperty
,org.refcodes.net.SchemeAccessor
,org.refcodes.net.SchemeAccessor.SchemeBuilder<B>
,org.refcodes.net.SchemeAccessor.SchemeMutator
,org.refcodes.net.SchemeAccessor.SchemeProperty
,org.refcodes.observer.Observable<B>
,org.refcodes.observer.Observers<RestEndpoint,RestServer>
,HttpExceptionHandlerAccessor
,HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<B>
,HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
,HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
,HttpExceptionHandlingAccessor
,HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<B>
,HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator
,HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
,HttpRestServer
,RestServer
,org.refcodes.runtime.RequestCorrelation<B>
,org.refcodes.runtime.SessionCorrelation<B>
,org.refcodes.security.KeyStoreDescriptorAccessor
,org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<B>
,org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator
,org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
- Direct Known Subclasses:
AbstractHttpRegistryRestServerDecorator
public abstract class AbstractHttpRestServerDecorator<B extends HttpRestServer> extends java.lang.Object implements HttpRestServer
Abstract class for easily decorating aHttpRestServer
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.net.BaseLocatorAccessor
org.refcodes.net.BaseLocatorAccessor.BaseLocatorBuilder<B extends org.refcodes.net.BaseLocatorAccessor.BaseLocatorBuilder<B>>, org.refcodes.net.BaseLocatorAccessor.BaseLocatorMutator, org.refcodes.net.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 java.lang.Object>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON extends java.lang.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 java.lang.Object>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON extends java.lang.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.net.MediaTypeFactoryLookup
org.refcodes.net.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.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
-
-
Field Summary
Fields Modifier and Type Field Description protected HttpRestServer
_server
-
Constructor Summary
Constructors Constructor Description AbstractHttpRestServerDecorator(HttpRestServer aServer)
Decorates the givenHttpRestServer
with additional functionality.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addMediaTypeFactory(org.refcodes.net.MediaTypeFactory aMediaTypeFactory)
void
close()
void
closeIn(int aCloseInMillis)
void
closeQuietly()
void
closeUnchecked()
void
disableRequestCorrelation()
void
disableSessionCorrelation()
void
enableRequestCorrelation()
void
enableSessionCorrelation()
java.lang.String
getBaseLocator()
org.refcodes.net.MediaType[]
getFactoryMediaTypes()
org.refcodes.security.KeyStoreDescriptor
getKeyStoreDescriptor()
int
getMaxConnections()
int
getPort()
java.lang.String
getRealm()
org.refcodes.data.Scheme
getScheme()
boolean
hasMediaTypeFactory(org.refcodes.net.MediaType aMediaType)
boolean
hasObserverSubscription(RestEndpoint aObserver)
boolean
hasRequestCorrelation()
boolean
hasSessionCorrelation()
java.util.Iterator<RestEndpoint>
observers()
B
onBasicAuthRequest(org.refcodes.net.BasicAuthObserver aObserver)
B
onConnectionRequest(org.refcodes.net.HttpsConnectionRequestObserver aObserver)
RestEndpointBuilder
onDelete(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestObserver)
: Registers aRestRequestObserver
with the given Locator-Pattern to incoming DELETE methods.RestEndpointBuilder
onGet(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestObserver)
: Registers aRestRequestObserver
with the given Locator-Pattern to incoming GET methods.RestEndpointBuilder
onPost(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestObserver)
: Registers aRestRequestObserver
with the given Locator-Pattern to incoming POST methods.RestEndpointBuilder
onPut(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestObserver)
: Registers aRestRequestObserver
with the given Locator-Pattern to incoming PUT methods.RestEndpointBuilder
onRequest(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Registers a pre-configuredRestEndpoint
, triggerd by any HTTP method, and returns its instance.RestEndpointBuilder
onRequest(org.refcodes.net.HttpMethod aHttpMethod, java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Registers a pre-configuredRestEndpoint
with the least required attributes and returns its instance.boolean
onRequest(RestEndpoint aRestEndpoint)
For the sake of unified naming, this method just delegates toObservable.subscribeObserver(Object)
.void
open(int aPort)
Opens the HTTP sever connection (socket) at the given portvoid
open(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.void
open(java.lang.String aProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, int aPort)
Same asHttpRestServer.open(String, KeyStoreDescriptor, int, int)
but: The number of maximum connections at the same time is decided upon by the implementations's default value.void
open(java.lang.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.void
openUnchecked(org.refcodes.net.HttpServerContext aConnection)
void
setBaseLocator(java.lang.String aBaseLocator)
void
setKeyStoreDescriptor(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor)
void
setMaxConnections(int aMaxConnections)
void
setPort(int aPort)
void
setProtocol(java.lang.String aProtocol)
void
setRealm(java.lang.String aRealm)
void
setRequestCorrelation(boolean hasRequestCorrelation)
void
setScheme(org.refcodes.data.Scheme aScheme)
void
setSessionCorrelation(boolean hasSessionCorrelation)
boolean
subscribeObserver(RestEndpoint aObserver)
org.refcodes.net.MediaTypeFactory
toMediaTypeFactory(org.refcodes.net.MediaType aMediaType)
java.lang.String
toProtocol()
boolean
unsubscribeObserver(RestEndpoint aObserver)
B
withBaseLocator(java.lang.String aBaseLocator)
B
withClose()
B
withCloseIn(int aCloseInMillis)
B
withCloseQuietly()
B
withCloseUnchecked()
B
withDisableRequestCorrelation()
B
withDisableSessionCorrelation()
B
withEnableRequestCorrelation()
B
withEnableSessionCorrelation()
B
withOpen(org.refcodes.net.HttpServerContext aConnection)
B
withOpenUnchecked(org.refcodes.net.HttpServerContext aConnection)
B
withRealm(java.lang.String aRealm)
B
withRequestCorrelation(boolean hasRequestCorrelation)
B
withSessionCorrelation(boolean hasSessionCorrelation)
-
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
getConnectionStatus, isConnectionOpened
-
Methods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor
getHttpExceptionHandler
-
Methods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder
withOnHttpException
-
Methods inherited from interface org.refcodes.rest.HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
onHttpException, setHttpExceptionHandler
-
Methods inherited from interface org.refcodes.rest.HttpExceptionHandlingAccessor
getHttpExceptionHandling
-
Methods inherited from interface org.refcodes.rest.HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator
setHttpExceptionHandling
-
Methods inherited from interface org.refcodes.rest.HttpRestServer
open, open, open, open, open, open, open, open, open, withHttpExceptionHandler, withHttpExceptionHandling, withKeyStoreDescriptor, withMaxConnections, withOpen, withPort, withProtocol, withScheme
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.refcodes.observer.Observers
disableObservers, enableObservers, isObserversActive, setObserversActive
-
Methods inherited from interface org.refcodes.rest.RestServer
withDisableObservers, withEnableObservers, withObserversActive
-
-
-
-
Field Detail
-
_server
protected HttpRestServer _server
-
-
Constructor Detail
-
AbstractHttpRestServerDecorator
public AbstractHttpRestServerDecorator(HttpRestServer aServer)
Decorates the givenHttpRestServer
with additional functionality.- Parameters:
aServer
- TheHttpRestServer
to be decorated.
-
-
Method Detail
-
getPort
public int getPort()
- Specified by:
getPort
in interfaceorg.refcodes.mixin.PortAccessor
-
setPort
public void setPort(int aPort)
- Specified by:
setPort
in interfaceorg.refcodes.mixin.PortAccessor.PortMutator
-
getScheme
public org.refcodes.data.Scheme getScheme()
- Specified by:
getScheme
in interfaceorg.refcodes.net.SchemeAccessor
-
setScheme
public void setScheme(org.refcodes.data.Scheme aScheme)
- Specified by:
setScheme
in interfaceorg.refcodes.net.SchemeAccessor.SchemeMutator
-
addMediaTypeFactory
public boolean addMediaTypeFactory(org.refcodes.net.MediaTypeFactory aMediaTypeFactory)
- Specified by:
addMediaTypeFactory
in interfaceorg.refcodes.net.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
-
close
public void close() throws org.refcodes.component.CloseException
- Specified by:
close
in interfaceorg.refcodes.component.Closable
- Throws:
org.refcodes.component.CloseException
-
closeIn
public void closeIn(int aCloseInMillis)
- Specified by:
closeIn
in interfaceorg.refcodes.component.Closable
-
closeQuietly
public void closeQuietly()
- Specified by:
closeQuietly
in interfaceorg.refcodes.component.Closable
-
closeUnchecked
public void closeUnchecked()
- Specified by:
closeUnchecked
in interfaceorg.refcodes.component.Closable
-
disableRequestCorrelation
public void disableRequestCorrelation()
- Specified by:
disableRequestCorrelation
in interfaceorg.refcodes.runtime.RequestCorrelation<B extends HttpRestServer>
-
disableSessionCorrelation
public void disableSessionCorrelation()
- Specified by:
disableSessionCorrelation
in interfaceorg.refcodes.runtime.SessionCorrelation<B extends HttpRestServer>
-
enableRequestCorrelation
public void enableRequestCorrelation()
- Specified by:
enableRequestCorrelation
in interfaceorg.refcodes.runtime.RequestCorrelation<B extends HttpRestServer>
-
enableSessionCorrelation
public void enableSessionCorrelation()
- Specified by:
enableSessionCorrelation
in interfaceorg.refcodes.runtime.SessionCorrelation<B extends HttpRestServer>
-
getBaseLocator
public java.lang.String getBaseLocator()
- Specified by:
getBaseLocator
in interfaceorg.refcodes.net.BaseLocatorAccessor
-
getFactoryMediaTypes
public org.refcodes.net.MediaType[] getFactoryMediaTypes()
- Specified by:
getFactoryMediaTypes
in interfaceorg.refcodes.net.MediaTypeFactoryLookup
-
getRealm
public java.lang.String getRealm()
- Specified by:
getRealm
in interfaceorg.refcodes.net.RealmAccessor
-
hasMediaTypeFactory
public boolean hasMediaTypeFactory(org.refcodes.net.MediaType aMediaType)
- Specified by:
hasMediaTypeFactory
in interfaceorg.refcodes.net.MediaTypeFactoryLookup
-
hasObserverSubscription
public boolean hasObserverSubscription(RestEndpoint aObserver)
- Specified by:
hasObserverSubscription
in interfaceorg.refcodes.observer.Observable<B extends HttpRestServer>
-
hasRequestCorrelation
public boolean hasRequestCorrelation()
- Specified by:
hasRequestCorrelation
in interfaceorg.refcodes.runtime.RequestCorrelation<B extends HttpRestServer>
-
hasSessionCorrelation
public boolean hasSessionCorrelation()
- Specified by:
hasSessionCorrelation
in interfaceorg.refcodes.runtime.SessionCorrelation<B extends HttpRestServer>
-
onBasicAuthRequest
public B onBasicAuthRequest(org.refcodes.net.BasicAuthObserver aObserver)
- Specified by:
onBasicAuthRequest
in interfaceorg.refcodes.net.BasicAuthObservable<B extends HttpRestServer>
-
onConnectionRequest
public B onConnectionRequest(org.refcodes.net.HttpsConnectionRequestObserver aObserver)
- Specified by:
onConnectionRequest
in interfaceorg.refcodes.net.HttpsConnectionRequestObservable<B extends HttpRestServer>
-
onDelete
public RestEndpointBuilder onDelete(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestObserver)
: Registers aRestRequestObserver
with the given Locator-Pattern to incoming DELETE methods. Attention: InvokeOpenable.open()
to activate this endpoint!- Specified by:
onDelete
in interfaceRestServer
- Parameters:
aLocatorPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestObserver
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onGet
public RestEndpointBuilder onGet(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestObserver)
: Registers aRestRequestObserver
with the given Locator-Pattern to incoming GET methods. Attention: InvokeOpenable.open()
to activate this endpoint!- Specified by:
onGet
in interfaceRestServer
- Parameters:
aLocatorPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestObserver
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onPost
public RestEndpointBuilder onPost(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestObserver)
: Registers aRestRequestObserver
with the given Locator-Pattern to incoming POST methods. Attention: InvokeOpenable.open()
to activate this endpoint!- Specified by:
onPost
in interfaceRestServer
- Parameters:
aLocatorPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestObserver
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onPut
public RestEndpointBuilder onPut(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestObserver)
: Registers aRestRequestObserver
with the given Locator-Pattern to incoming PUT methods. Attention: InvokeOpenable.open()
to activate this endpoint!- Specified by:
onPut
in interfaceRestServer
- Parameters:
aLocatorPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestObserver
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onRequest
public RestEndpointBuilder onRequest(org.refcodes.net.HttpMethod aHttpMethod, java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Registers a pre-configuredRestEndpoint
with the least required attributes and returns its instance. To unsubscribe viaObservable.unsubscribeObserver(Object)
, use the returned instance. Attention: InvokeOpenable.open()
to activate this endpoint!- Specified by:
onRequest
in interfaceRestServer
- Parameters:
aHttpMethod
- The HTTP-Method to which thisRestEndpoint
is bound. A value ofnull
means that any HTTP-Method may trigger thisRestEndpoint
.aLocatorPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound. A value ofnull
means that any locator may trigger thisRestEndpoint
.aRequestObserver
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onRequest
public boolean onRequest(RestEndpoint aRestEndpoint)
For the sake of unified naming, this method just delegates toObservable.subscribeObserver(Object)
.- Specified by:
onRequest
in interfaceRestServer
- Parameters:
aRestEndpoint
- the rest endpoint- Returns:
- true, if successful
-
onRequest
public RestEndpointBuilder onRequest(java.lang.String aLocatorPattern, RestRequestObserver aRequestObserver)
Registers a pre-configuredRestEndpoint
, triggerd by any HTTP method, and returns its instance. To unsubscribe viaObservable.unsubscribeObserver(Object)
, use the returned instance. Attention: InvokeOpenable.open()
to activate this endpoint!- Specified by:
onRequest
in interfaceRestServer
- Parameters:
aLocatorPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestObserver
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
open
public void open(int aPort) throws org.refcodes.component.OpenException
Opens the HTTP sever connection (socket) at the given port- Specified by:
open
in interfaceHttpRestServer
- Parameters:
aPort
- The port on which to listen for requests.- Throws:
org.refcodes.component.OpenException
- thrown in case something went wrong such as the port being already in use.
-
open
public void open(int aPort, int aMaxConnections) throws org.refcodes.component.OpenException
Opens the HTTP sever connection (socket) at the given port allowing the given number of maximum connections at the same time.- Specified by:
open
in interfaceHttpRestServer
- Parameters:
aPort
- The port on which to listen for requests.aMaxConnections
- The number of maximum connections at the same time.- Throws:
org.refcodes.component.OpenException
- thrown in case something went wrong such as the port being already in use.
-
open
public void open(java.lang.String aProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, int aPort) throws org.refcodes.component.OpenException
Same asHttpRestServer.open(String, KeyStoreDescriptor, int, int)
but:- The number of maximum connections at the same time is decided upon by the implementations's default value.
- Specified by:
open
in interfaceHttpRestServer
- 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.- Throws:
org.refcodes.component.OpenException
- thrown in case something went wrong such as the port being already in use.
-
open
public void open(java.lang.String aProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, int aPort, int aMaxConnections) throws org.refcodes.component.OpenException
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 interfaceHttpRestServer
- 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:
org.refcodes.component.OpenException
- thrown in case something went wrong such as the port being already in use.
-
openUnchecked
public void openUnchecked(org.refcodes.net.HttpServerContext aConnection)
- Specified by:
openUnchecked
in interfaceorg.refcodes.component.ConnectionOpenable<B extends HttpRestServer>
-
setBaseLocator
public void setBaseLocator(java.lang.String aBaseLocator)
- Specified by:
setBaseLocator
in interfaceorg.refcodes.net.BaseLocatorAccessor.BaseLocatorMutator
-
setRealm
public void setRealm(java.lang.String aRealm)
- Specified by:
setRealm
in interfaceorg.refcodes.net.RealmAccessor.RealmMutator
-
setRequestCorrelation
public void setRequestCorrelation(boolean hasRequestCorrelation)
- Specified by:
setRequestCorrelation
in interfaceorg.refcodes.runtime.RequestCorrelation<B extends HttpRestServer>
-
setSessionCorrelation
public void setSessionCorrelation(boolean hasSessionCorrelation)
- Specified by:
setSessionCorrelation
in interfaceorg.refcodes.runtime.SessionCorrelation<B extends HttpRestServer>
-
subscribeObserver
public boolean subscribeObserver(RestEndpoint aObserver)
- Specified by:
subscribeObserver
in interfaceorg.refcodes.observer.Observable<B extends HttpRestServer>
-
toMediaTypeFactory
public org.refcodes.net.MediaTypeFactory toMediaTypeFactory(org.refcodes.net.MediaType aMediaType)
- Specified by:
toMediaTypeFactory
in interfaceorg.refcodes.net.MediaTypeFactoryLookup
-
unsubscribeObserver
public boolean unsubscribeObserver(RestEndpoint aObserver)
- Specified by:
unsubscribeObserver
in interfaceorg.refcodes.observer.Observable<B extends HttpRestServer>
-
observers
public java.util.Iterator<RestEndpoint> observers()
- Specified by:
observers
in interfaceorg.refcodes.observer.Observers<RestEndpoint,RestServer>
-
withBaseLocator
public B withBaseLocator(java.lang.String aBaseLocator)
- Specified by:
withBaseLocator
in interfaceorg.refcodes.net.BaseLocatorAccessor.BaseLocatorBuilder<B extends HttpRestServer>
- Specified by:
withBaseLocator
in interfaceHttpRestServer
- Specified by:
withBaseLocator
in interfaceRestServer
-
withClose
public B withClose() throws org.refcodes.component.CloseException
- Specified by:
withClose
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends HttpRestServer>
- Specified by:
withClose
in interfaceHttpRestServer
- Throws:
org.refcodes.component.CloseException
-
withCloseIn
public B withCloseIn(int aCloseInMillis)
- Specified by:
withCloseIn
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends HttpRestServer>
- Specified by:
withCloseIn
in interfaceHttpRestServer
-
withCloseQuietly
public B withCloseQuietly()
- Specified by:
withCloseQuietly
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends HttpRestServer>
- Specified by:
withCloseQuietly
in interfaceHttpRestServer
-
withCloseUnchecked
public B withCloseUnchecked()
- Specified by:
withCloseUnchecked
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends HttpRestServer>
-
withDisableRequestCorrelation
public B withDisableRequestCorrelation()
- Specified by:
withDisableRequestCorrelation
in interfaceHttpRestServer
- Specified by:
withDisableRequestCorrelation
in interfaceorg.refcodes.runtime.RequestCorrelation<B extends HttpRestServer>
- Specified by:
withDisableRequestCorrelation
in interfaceRestServer
-
withDisableSessionCorrelation
public B withDisableSessionCorrelation()
- Specified by:
withDisableSessionCorrelation
in interfaceHttpRestServer
- Specified by:
withDisableSessionCorrelation
in interfaceRestServer
- Specified by:
withDisableSessionCorrelation
in interfaceorg.refcodes.runtime.SessionCorrelation<B extends HttpRestServer>
-
withEnableRequestCorrelation
public B withEnableRequestCorrelation()
- Specified by:
withEnableRequestCorrelation
in interfaceHttpRestServer
- Specified by:
withEnableRequestCorrelation
in interfaceorg.refcodes.runtime.RequestCorrelation<B extends HttpRestServer>
- Specified by:
withEnableRequestCorrelation
in interfaceRestServer
-
withEnableSessionCorrelation
public B withEnableSessionCorrelation()
- Specified by:
withEnableSessionCorrelation
in interfaceHttpRestServer
- Specified by:
withEnableSessionCorrelation
in interfaceRestServer
- Specified by:
withEnableSessionCorrelation
in interfaceorg.refcodes.runtime.SessionCorrelation<B extends HttpRestServer>
-
withOpen
public B withOpen(org.refcodes.net.HttpServerContext aConnection) throws org.refcodes.component.OpenException
- Specified by:
withOpen
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<RestEndpoint,RestServer>
- Specified by:
withOpen
in interfaceHttpRestServer
- Throws:
org.refcodes.component.OpenException
-
withOpenUnchecked
public B withOpenUnchecked(org.refcodes.net.HttpServerContext aConnection)
- Specified by:
withOpenUnchecked
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<RestEndpoint,RestServer>
-
withRealm
public B withRealm(java.lang.String aRealm)
- Specified by:
withRealm
in interfaceHttpRestServer
- Specified by:
withRealm
in interfaceorg.refcodes.net.RealmAccessor.RealmBuilder<B extends HttpRestServer>
- Specified by:
withRealm
in interfaceRestServer
-
withRequestCorrelation
public B withRequestCorrelation(boolean hasRequestCorrelation)
- Specified by:
withRequestCorrelation
in interfaceHttpRestServer
- Specified by:
withRequestCorrelation
in interfaceorg.refcodes.runtime.RequestCorrelation<B extends HttpRestServer>
- Specified by:
withRequestCorrelation
in interfaceRestServer
-
withSessionCorrelation
public B withSessionCorrelation(boolean hasSessionCorrelation)
- Specified by:
withSessionCorrelation
in interfaceHttpRestServer
- Specified by:
withSessionCorrelation
in interfaceRestServer
- Specified by:
withSessionCorrelation
in interfaceorg.refcodes.runtime.SessionCorrelation<B extends HttpRestServer>
-
getMaxConnections
public int getMaxConnections()
- Specified by:
getMaxConnections
in interfaceorg.refcodes.io.MaxConnectionsAccessor
-
getKeyStoreDescriptor
public org.refcodes.security.KeyStoreDescriptor getKeyStoreDescriptor()
- Specified by:
getKeyStoreDescriptor
in interfaceorg.refcodes.security.KeyStoreDescriptorAccessor
-
setKeyStoreDescriptor
public void setKeyStoreDescriptor(org.refcodes.security.KeyStoreDescriptor aStoreDescriptor)
- Specified by:
setKeyStoreDescriptor
in interfaceorg.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator
-
setMaxConnections
public void setMaxConnections(int aMaxConnections)
- Specified by:
setMaxConnections
in interfaceorg.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator
-
setProtocol
public void setProtocol(java.lang.String aProtocol)
- Specified by:
setProtocol
in interfaceorg.refcodes.net.SchemeAccessor.SchemeMutator
-
toProtocol
public java.lang.String toProtocol()
- Specified by:
toProtocol
in interfaceorg.refcodes.net.SchemeAccessor
-
-