Module org.refcodes.rest
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<org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,
,HttpRestServer>> org.refcodes.component.ConnectionComponent<org.refcodes.web.HttpServerContext>
,org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext,
,HttpRestServer> 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, HttpRestServer>> 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<HttpRestServer>
,org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsMutator
,org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty
,org.refcodes.mixin.PortAccessor
,org.refcodes.mixin.PortAccessor.PortBuilder<HttpRestServer>
,org.refcodes.mixin.PortAccessor.PortMutator
,org.refcodes.mixin.PortAccessor.PortProperty
,org.refcodes.observer.Observable<RestEndpoint>
,org.refcodes.observer.Observers<RestEndpoint,
,RestServer> HttpExceptionHandlerAccessor
,HttpExceptionHandlerAccessor.HttpExceptionHandlerBuilder<RestServer>
,HttpExceptionHandlerAccessor.HttpExceptionHandlerMutator
,HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
,HttpExceptionHandlingAccessor
,HttpExceptionHandlingAccessor.HttpExceptionHandlingBuilder<RestServer>
,HttpExceptionHandlingAccessor.HttpExceptionHandlingMutator
,HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
,HttpRestServer
,RestServer
,org.refcodes.runtime.RequestCorrelation<RestServer>
,org.refcodes.runtime.SessionCorrelation<RestServer>
,org.refcodes.security.KeyStoreDescriptorAccessor
,org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorBuilder<HttpRestServer>
,org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorMutator
,org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
,org.refcodes.web.BaseLocatorAccessor
,org.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<RestServer>
,org.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator
,org.refcodes.web.BaseLocatorAccessor.BaseLocatorProperty
,org.refcodes.web.BasicAuthObservable<HttpRestServer>
,org.refcodes.web.HttpsConnectionRequestObservable<HttpRestServer>
,org.refcodes.web.MediaTypeFactoryLookup
,org.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
,org.refcodes.web.RealmAccessor
,org.refcodes.web.RealmAccessor.RealmBuilder<RestServer>
,org.refcodes.web.RealmAccessor.RealmMutator
,org.refcodes.web.RealmAccessor.RealmProperty
,org.refcodes.web.SchemeAccessor
,org.refcodes.web.SchemeAccessor.SchemeBuilder<HttpRestServer>
,org.refcodes.web.SchemeAccessor.SchemeMutator
,org.refcodes.web.SchemeAccessor.SchemeProperty
- Direct Known Subclasses:
AbstractHttpRegistryRestServerDecorator
public abstract class AbstractHttpRestServerDecorator<B extends HttpRestServer>
extends Object
implements HttpRestServer
Abstract class for easily decorating a
HttpRestServer
.-
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addMediaTypeFactory
(org.refcodes.web.MediaTypeFactory aMediaTypeFactory) void
close()
void
closeIn
(int aCloseMillis) void
void
void
void
void
void
org.refcodes.web.MediaType[]
org.refcodes.security.KeyStoreDescriptor
int
int
getPort()
getRealm()
org.refcodes.data.Scheme
boolean
hasMediaTypeFactory
(org.refcodes.web.MediaType aMediaType) boolean
hasObserverSubscription
(RestEndpoint aObserver) boolean
boolean
onBasicAuthRequest
(org.refcodes.web.BasicAuthObserver aObserver) onConnectionRequest
(org.refcodes.web.HttpsConnectionRequestObserver aObserver) onDelete
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming DELETE methods.onDelete
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming DELETE methods.onGet
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming GET methods.onGet
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming GET methods.onPost
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming POST methods.onPost
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming POST methods.onPut
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming PUT methods.onPut
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming PUT methods.onRequest
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Registers a pre-configuredRestEndpoint
, triggerd by any HTTP method, and returns its instance.onRequest
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) Registers a pre-configuredRestEndpoint
, triggerd by any HTTP method, and returns its instance.boolean
onRequest
(RestEndpoint aRestEndpoint) For the sake of unified naming, this method just delegates toObservable.subscribeObserver(Object)
.onRequest
(org.refcodes.web.HttpMethod aHttpMethod, String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Registers a pre-configuredRestEndpoint
with the least required attributes and returns its instance.onRequest
(org.refcodes.web.HttpMethod aHttpMethod, Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) Registers a pre-configuredRestEndpoint
with the least required attributes and returns its instance.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
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
(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.web.HttpServerContext aConnection) void
setBaseLocator
(String aBaseLocator) void
setKeyStoreDescriptor
(org.refcodes.security.KeyStoreDescriptor aKeyStoreDescriptor) void
setMaxConnections
(int aMaxConnections) void
setPort
(int aPort) void
setProtocol
(String aProtocol) void
void
setRequestCorrelation
(boolean hasRequestCorrelation) void
setScheme
(org.refcodes.data.Scheme aScheme) void
setSessionCorrelation
(boolean hasSessionCorrelation) boolean
subscribeObserver
(RestEndpoint aObserver) org.refcodes.web.MediaTypeFactory
toMediaTypeFactory
(org.refcodes.web.MediaType aMediaType) boolean
unsubscribeObserver
(RestEndpoint aObserver) withBaseLocator
(String aBaseLocator) withCloseIn
(int aCloseMillis) withOpen
(org.refcodes.web.HttpServerContext aConnection) withOpenUnchecked
(org.refcodes.web.HttpServerContext aConnection) withRequestCorrelation
(boolean hasRequestCorrelation) withSessionCorrelation
(boolean hasSessionCorrelation) 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.BaseLocatorProperty
letBaseLocator
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
getConnectionStatus, isOpened
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.HttpExceptionHandlerAccessor.HttpExceptionHandlerProperty
letHttpExceptionHandler
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.HttpExceptionHandlingAccessor.HttpExceptionHandlingProperty
letHttpExceptionHandling
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 interface org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
letKeyStoreDescriptor
Methods inherited from interface org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty
letMaxConnections
Methods inherited from interface org.refcodes.observer.Observers
disableObservers, enableObservers, isObserversActive, 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.RealmProperty
letRealm
Methods inherited from interface org.refcodes.rest.RestServer
withDisableObservers, withEnableObservers, withObserversActive
Methods inherited from interface org.refcodes.web.SchemeAccessor.SchemeProperty
letProtocol, letScheme
-
Field Details
-
_server
-
-
Constructor Details
-
AbstractHttpRestServerDecorator
Decorates the givenHttpRestServer
with additional functionality.- Parameters:
aServer
- TheHttpRestServer
to be decorated.
-
-
Method Details
-
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.web.SchemeAccessor
-
setScheme
public void setScheme(org.refcodes.data.Scheme aScheme) - Specified by:
setScheme
in interfaceorg.refcodes.web.SchemeAccessor.SchemeMutator
-
addMediaTypeFactory
public boolean addMediaTypeFactory(org.refcodes.web.MediaTypeFactory aMediaTypeFactory) - Specified by:
addMediaTypeFactory
in interfaceorg.refcodes.web.MediaTypeFactoryLookup.MutableMediaTypeFactoryLookup
-
close
- Specified by:
close
in interfaceorg.refcodes.component.Closable
- Throws:
IOException
-
closeIn
public void closeIn(int aCloseMillis) - 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
- Specified by:
getBaseLocator
in interfaceorg.refcodes.web.BaseLocatorAccessor
-
getFactoryMediaTypes
public org.refcodes.web.MediaType[] getFactoryMediaTypes()- Specified by:
getFactoryMediaTypes
in interfaceorg.refcodes.web.MediaTypeFactoryLookup
-
getRealm
- Specified by:
getRealm
in interfaceorg.refcodes.web.RealmAccessor
-
hasMediaTypeFactory
public boolean hasMediaTypeFactory(org.refcodes.web.MediaType aMediaType) - Specified by:
hasMediaTypeFactory
in interfaceorg.refcodes.web.MediaTypeFactoryLookup
-
hasObserverSubscription
- 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
- Specified by:
onBasicAuthRequest
in interfaceorg.refcodes.web.BasicAuthObservable<B extends HttpRestServer>
-
onConnectionRequest
- Specified by:
onConnectionRequest
in interfaceorg.refcodes.web.HttpsConnectionRequestObservable<B extends HttpRestServer>
-
onDelete
public RestEndpointBuilder onDelete(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming DELETE methods. Attention: InvokeRestEndpointBuilder.open()
to activate this endpoint!- Specified by:
onDelete
in interfaceRestServer
- Parameters:
aLocatorPathPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onGet
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming GET methods. Attention: InvokeRestEndpointBuilder.open()
to activate this endpoint!- Specified by:
onGet
in interfaceRestServer
- Parameters:
aLocatorPathPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onPost
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming POST methods. Attention: InvokeRestEndpointBuilder.open()
to activate this endpoint!- Specified by:
onPost
in interfaceRestServer
- Parameters:
aLocatorPathPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onPut
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming PUT methods. Attention: InvokeRestEndpointBuilder.open()
to activate this endpoint!- Specified by:
onPut
in interfaceRestServer
- Parameters:
aLocatorPathPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestConsumer
- 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.web.HttpMethod aHttpMethod, String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Registers a pre-configuredRestEndpoint
with the least required attributes and returns its instance. To unsubscribe viaObservable.unsubscribeObserver(Object)
, use the returned instance. Attention: InvokeRestEndpointBuilder.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
.aLocatorPathPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound. A value ofnull
means that any locator may trigger thisRestEndpoint
.aRequestConsumer
- 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(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Registers a pre-configuredRestEndpoint
, triggerd by any HTTP method, and returns its instance. To unsubscribe viaObservable.unsubscribeObserver(Object)
, use the returned instance. Attention: InvokeRestEndpointBuilder.open()
to activate this endpoint!- Specified by:
onRequest
in interfaceRestServer
- Parameters:
aLocatorPathPattern
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onDelete
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming DELETE methods. Attention: InvokeRestEndpointBuilder.open()
to activate this endpoint!- Specified by:
onDelete
in interfaceRestServer
- Parameters:
aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onGet
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming GET methods. Attention: InvokeRestEndpointBuilder.open()
to activate this endpoint!- Specified by:
onGet
in interfaceRestServer
- Parameters:
aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onPost
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming POST methods. Attention: InvokeRestEndpointBuilder.open()
to activate this endpoint!- Specified by:
onPost
in interfaceRestServer
- Parameters:
aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onPut
Even more convenient: Everything done here can also be done usingRestServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming PUT methods. Attention: InvokeRestEndpointBuilder.open()
to activate this endpoint!- Specified by:
onPut
in interfaceRestServer
- Parameters:
aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- 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.web.HttpMethod aHttpMethod, Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) Registers a pre-configuredRestEndpoint
with the least required attributes and returns its instance. To unsubscribe viaObservable.unsubscribeObserver(Object)
, use the returned instance. Attention: InvokeRestEndpointBuilder.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
.aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound. A value ofnull
means that any locator may trigger thisRestEndpoint
.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onRequest
Registers a pre-configuredRestEndpoint
, triggerd by any HTTP method, and returns its instance. To unsubscribe viaObservable.unsubscribeObserver(Object)
, use the returned instance. Attention: InvokeRestEndpointBuilder.open()
to activate this endpoint!- Specified by:
onRequest
in interfaceRestServer
- Parameters:
aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The pre-configured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onRequest
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
-
open
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:
IOException
- thrown in case something went wrong such as the port being already in use.
-
open
Opens the HTTP sever connection (socket) at the given port allowing the given number of maximum connections at the same time.- 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:
IOException
- thrown in case something went wrong such as the port being already in use.
-
open
public void open(String aProtocol, org.refcodes.security.KeyStoreDescriptor aStoreDescriptor, int aPort) throws IOException 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:
IOException
- thrown in case something went wrong such as the port being already in use.
-
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 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:
IOException
- thrown in case something went wrong such as the port being already in use.
-
openUnchecked
public void openUnchecked(org.refcodes.web.HttpServerContext aConnection) - Specified by:
openUnchecked
in interfaceorg.refcodes.component.ConnectionOpenable<B extends HttpRestServer>
-
setBaseLocator
- Specified by:
setBaseLocator
in interfaceorg.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator
-
setRealm
- Specified by:
setRealm
in interfaceorg.refcodes.web.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
- Specified by:
subscribeObserver
in interfaceorg.refcodes.observer.Observable<B extends HttpRestServer>
-
toMediaTypeFactory
public org.refcodes.web.MediaTypeFactory toMediaTypeFactory(org.refcodes.web.MediaType aMediaType) - Specified by:
toMediaTypeFactory
in interfaceorg.refcodes.web.MediaTypeFactoryLookup
-
unsubscribeObserver
- Specified by:
unsubscribeObserver
in interfaceorg.refcodes.observer.Observable<B extends HttpRestServer>
-
observers
- Specified by:
observers
in interfaceorg.refcodes.observer.Observers<RestEndpoint,
RestServer>
-
withBaseLocator
- Specified by:
withBaseLocator
in interfaceorg.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<B extends HttpRestServer>
- Specified by:
withBaseLocator
in interfaceHttpRestServer
- Specified by:
withBaseLocator
in interfaceRestServer
-
withClose
- Specified by:
withClose
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends HttpRestServer>
- Specified by:
withClose
in interfaceHttpRestServer
- Throws:
IOException
-
withCloseIn
- Specified by:
withCloseIn
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends HttpRestServer>
- Specified by:
withCloseIn
in interfaceHttpRestServer
-
withCloseQuietly
- Specified by:
withCloseQuietly
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends HttpRestServer>
- Specified by:
withCloseQuietly
in interfaceHttpRestServer
-
withCloseUnchecked
- Specified by:
withCloseUnchecked
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends HttpRestServer>
-
withDisableRequestCorrelation
- Specified by:
withDisableRequestCorrelation
in interfaceHttpRestServer
- Specified by:
withDisableRequestCorrelation
in interfaceorg.refcodes.runtime.RequestCorrelation<B extends HttpRestServer>
- Specified by:
withDisableRequestCorrelation
in interfaceRestServer
-
withDisableSessionCorrelation
- Specified by:
withDisableSessionCorrelation
in interfaceHttpRestServer
- Specified by:
withDisableSessionCorrelation
in interfaceRestServer
- Specified by:
withDisableSessionCorrelation
in interfaceorg.refcodes.runtime.SessionCorrelation<B extends HttpRestServer>
-
withEnableRequestCorrelation
- Specified by:
withEnableRequestCorrelation
in interfaceHttpRestServer
- Specified by:
withEnableRequestCorrelation
in interfaceorg.refcodes.runtime.RequestCorrelation<B extends HttpRestServer>
- Specified by:
withEnableRequestCorrelation
in interfaceRestServer
-
withEnableSessionCorrelation
- Specified by:
withEnableSessionCorrelation
in interfaceHttpRestServer
- Specified by:
withEnableSessionCorrelation
in interfaceRestServer
- Specified by:
withEnableSessionCorrelation
in interfaceorg.refcodes.runtime.SessionCorrelation<B extends HttpRestServer>
-
withOpen
- Specified by:
withOpen
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,
org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext, HttpRestServer>> - Specified by:
withOpen
in interfaceHttpRestServer
- Throws:
IOException
-
withOpenUnchecked
- Specified by:
withOpenUnchecked
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,
org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext, HttpRestServer>>
-
withRealm
- Specified by:
withRealm
in interfaceHttpRestServer
- Specified by:
withRealm
in interfaceorg.refcodes.web.RealmAccessor.RealmBuilder<B extends HttpRestServer>
- Specified by:
withRealm
in interfaceRestServer
-
withRequestCorrelation
- Specified by:
withRequestCorrelation
in interfaceHttpRestServer
- Specified by:
withRequestCorrelation
in interfaceorg.refcodes.runtime.RequestCorrelation<B extends HttpRestServer>
- Specified by:
withRequestCorrelation
in interfaceRestServer
-
withSessionCorrelation
- 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 aKeyStoreDescriptor) - 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
- Specified by:
setProtocol
in interfaceorg.refcodes.web.SchemeAccessor.SchemeMutator
-
toProtocol
- Specified by:
toProtocol
in interfaceorg.refcodes.web.SchemeAccessor
-