Module org.refcodes.rest
Package org.refcodes.rest
Class AbstractRestfulHttpServerDecorator<B extends RestfulHttpServer>
java.lang.Object
org.refcodes.rest.AbstractRestfulHttpServerDecorator<B>
- Type Parameters:
B
- the generic type
- 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.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:
AbstractRestfulHttpRegistryServerDecorator
public abstract class AbstractRestfulHttpServerDecorator<B extends RestfulHttpServer>
extends Object
implements RestfulHttpServer
Abstract class for easily decorating a
RestfulHttpServer
.-
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) boolean
addPostHttpInterceptor
(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) boolean
addPreHttpInterceptor
(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) void
close()
void
closeIn
(int aCloseMillis) 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
hasObserver
(RestEndpoint aObserver) boolean
hasPostHttpInterceptor
(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) boolean
hasPreHttpInterceptor
(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) 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 usingRestfulServer.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 usingRestfulServer.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 usingRestfulServer.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 usingRestfulServer.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 usingRestfulServer.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 usingRestfulServer.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 usingRestfulServer.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 usingRestfulServer.onRequest(HttpMethod, String, RestRequestConsumer)
: Registers aRestRequestConsumer
with the given Locator-Pattern to incoming PUT methods.onRequest
(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Registers a preconfiguredRestEndpoint
, triggerd by any HTTP method, and returns its instance.onRequest
(Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) Registers a preconfiguredRestEndpoint
, 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 preconfiguredRestEndpoint
with the least required attributes and returns its instance.onRequest
(org.refcodes.web.HttpMethod aHttpMethod, Pattern aLocatorRegExp, RestRequestConsumer aRequestConsumer) Registers a preconfiguredRestEndpoint
with the least required attributes and returns its instance.void
open
(int aPort) Opens the HTTP sever connection (socket) at the given port.void
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 asRestfulHttpServer.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) boolean
removePostHttpInterceptor
(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) boolean
removePreHttpInterceptor
(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) 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
setScheme
(org.refcodes.data.Scheme aScheme) 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) 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.web.HttpServerInterceptable
addHttpInterceptor, hasHttpInterceptor, removeHttpInterceptor
Methods inherited from interface org.refcodes.security.KeyStoreDescriptorAccessor.KeyStoreDescriptorProperty
letKeyStoreDescriptor
Methods inherited from interface org.refcodes.io.MaxConnectionsAccessor.MaxConnectionsProperty
letMaxConnections
Methods inherited from interface org.refcodes.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.RestfulHttpServer
open, open, open, open, open, open, open, open, open, withHttpExceptionHandler, withHttpExceptionHandling, withKeyStoreDescriptor, withMaxConnections, withOpen, withPort, withProtocol, withScheme
Methods inherited from interface org.refcodes.rest.RestfulServer
withDisableObservers, withEnableObservers, withObserversActive
Methods inherited from interface org.refcodes.web.SchemeAccessor.SchemeProperty
letProtocol, letScheme
-
Field Details
-
_server
-
-
Constructor Details
-
AbstractRestfulHttpServerDecorator
Decorates the givenRestfulHttpServer
with additional functionality.- Parameters:
aServer
- TheRestfulHttpServer
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
-
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
-
hasObserver
- Specified by:
hasObserver
in interfaceorg.refcodes.observer.Observable<B extends RestfulHttpServer>
-
onBasicAuthRequest
- Specified by:
onBasicAuthRequest
in interfaceorg.refcodes.web.BasicAuthObservable<B extends RestfulHttpServer>
-
onConnectionRequest
- Specified by:
onConnectionRequest
in interfaceorg.refcodes.web.HttpsConnectionRequestObservable<B extends RestfulHttpServer>
-
onDelete
public RestEndpointBuilder onDelete(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Even more convenient: Everything done here can also be done usingRestfulServer.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 interfaceRestfulServer
- Parameters:
aLocatorPathPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The preconfigured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onGet
Even more convenient: Everything done here can also be done usingRestfulServer.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 interfaceRestfulServer
- Parameters:
aLocatorPathPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The preconfigured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onPost
Even more convenient: Everything done here can also be done usingRestfulServer.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 interfaceRestfulServer
- Parameters:
aLocatorPathPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The preconfigured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onPut
Even more convenient: Everything done here can also be done usingRestfulServer.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 interfaceRestfulServer
- Parameters:
aLocatorPathPattern
- The local Locator-Pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The preconfigured
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 preconfiguredRestEndpoint
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 interfaceRestfulServer
- 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 preconfigured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onRequest
public RestEndpointBuilder onRequest(String aLocatorPathPattern, RestRequestConsumer aRequestConsumer) Registers a preconfiguredRestEndpoint
, 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 interfaceRestfulServer
- Parameters:
aLocatorPathPattern
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The preconfigured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onDelete
Even more convenient: Everything done here can also be done usingRestfulServer.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 interfaceRestfulServer
- Parameters:
aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The preconfigured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onGet
Even more convenient: Everything done here can also be done usingRestfulServer.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 interfaceRestfulServer
- Parameters:
aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The preconfigured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onPost
Even more convenient: Everything done here can also be done usingRestfulServer.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 interfaceRestfulServer
- Parameters:
aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The preconfigured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onPut
Even more convenient: Everything done here can also be done usingRestfulServer.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 interfaceRestfulServer
- Parameters:
aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The preconfigured
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 preconfiguredRestEndpoint
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 interfaceRestfulServer
- 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 preconfigured
RestEndpoint
which acts as handle to unsubscribe theRestEndpoint
viaObservable.unsubscribeObserver(Object)
.
-
onRequest
Registers a preconfiguredRestEndpoint
, 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 interfaceRestfulServer
- Parameters:
aLocatorRegExp
- The local locator (regular expression) pattern to which thisRestEndpoint
is bound.aRequestConsumer
- The listener processing a request targeted at thisRestEndpoint
.- Returns:
- The preconfigured
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 interfaceRestfulServer
- Parameters:
aRestEndpoint
- the rest endpoint- Returns:
- true, if successful
-
open
Opens the HTTP sever connection (socket) at the given port.- Specified by:
open
in interfaceRestfulHttpServer
- 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 interfaceRestfulHttpServer
- 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 asRestfulHttpServer.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 interfaceRestfulHttpServer
- Parameters:
aProtocol
- The protocol to use, e.g. "TLS".aStoreDescriptor
- The store descriptor describing yourKeyStore
required for HTTPS.aPort
- The port on which to listen for requests.- 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 interfaceRestfulHttpServer
- Parameters:
aProtocol
- The protocol to use, e.g. "TLS".aStoreDescriptor
- The store descriptor describing yourKeyStore
required for HTTPS.aPort
- The port on which to listen for requests.aMaxConnections
- The number of maximum connections at the same time.- Throws:
IOException
- thrown in case something went wrong such as the port being already in use.
-
openUnchecked
public void openUnchecked(org.refcodes.web.HttpServerContext aConnection) - Specified by:
openUnchecked
in interfaceorg.refcodes.component.ConnectionOpenable<B extends RestfulHttpServer>
-
setBaseLocator
- Specified by:
setBaseLocator
in interfaceorg.refcodes.web.BaseLocatorAccessor.BaseLocatorMutator
-
setRealm
- Specified by:
setRealm
in interfaceorg.refcodes.web.RealmAccessor.RealmMutator
-
subscribeObserver
- Specified by:
subscribeObserver
in interfaceorg.refcodes.observer.Observable<B extends RestfulHttpServer>
-
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 RestfulHttpServer>
-
observers
- Specified by:
observers
in interfaceorg.refcodes.observer.Observers<RestEndpoint,
RestfulServer>
-
withBaseLocator
- Specified by:
withBaseLocator
in interfaceorg.refcodes.web.BaseLocatorAccessor.BaseLocatorBuilder<B extends RestfulHttpServer>
- Specified by:
withBaseLocator
in interfaceRestfulHttpServer
- Specified by:
withBaseLocator
in interfaceRestfulServer
-
withClose
- Specified by:
withClose
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends RestfulHttpServer>
- Specified by:
withClose
in interfaceRestfulHttpServer
- Throws:
IOException
-
withCloseIn
- Specified by:
withCloseIn
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends RestfulHttpServer>
- Specified by:
withCloseIn
in interfaceRestfulHttpServer
-
withCloseQuietly
- Specified by:
withCloseQuietly
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends RestfulHttpServer>
- Specified by:
withCloseQuietly
in interfaceRestfulHttpServer
-
withCloseUnchecked
- Specified by:
withCloseUnchecked
in interfaceorg.refcodes.component.Closable.CloseBuilder<B extends RestfulHttpServer>
-
withOpen
- Specified by:
withOpen
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,
org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext, RestfulHttpServer>> - Specified by:
withOpen
in interfaceRestfulHttpServer
- Throws:
IOException
-
withOpenUnchecked
- Specified by:
withOpenUnchecked
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<org.refcodes.web.HttpServerContext,
org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<org.refcodes.web.HttpServerContext, RestfulHttpServer>>
-
withRealm
- Specified by:
withRealm
in interfaceorg.refcodes.web.RealmAccessor.RealmBuilder<B extends RestfulHttpServer>
- Specified by:
withRealm
in interfaceRestfulHttpServer
- Specified by:
withRealm
in interfaceRestfulServer
-
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
-
hasPreHttpInterceptor
public boolean hasPreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) - Specified by:
hasPreHttpInterceptor
in interfaceorg.refcodes.web.PreHttpInterceptable<B extends RestfulHttpServer>
-
addPreHttpInterceptor
public boolean addPreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) - Specified by:
addPreHttpInterceptor
in interfaceorg.refcodes.web.PreHttpInterceptable<B extends RestfulHttpServer>
-
removePreHttpInterceptor
public boolean removePreHttpInterceptor(org.refcodes.web.PreHttpServerInterceptor aPreInterceptor) - Specified by:
removePreHttpInterceptor
in interfaceorg.refcodes.web.PreHttpInterceptable<B extends RestfulHttpServer>
-
hasPostHttpInterceptor
public boolean hasPostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) - Specified by:
hasPostHttpInterceptor
in interfaceorg.refcodes.web.PostHttpInterceptable<B extends RestfulHttpServer>
-
addPostHttpInterceptor
public boolean addPostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) - Specified by:
addPostHttpInterceptor
in interfaceorg.refcodes.web.PostHttpInterceptable<B extends RestfulHttpServer>
-
removePostHttpInterceptor
public boolean removePostHttpInterceptor(org.refcodes.web.PostHttpServerInterceptor aPostInterceptor) - Specified by:
removePostHttpInterceptor
in interfaceorg.refcodes.web.PostHttpInterceptable<B extends RestfulHttpServer>
-