Package org.refcodes.rest
Interface RestEndpointBuilder
-
- All Superinterfaces:
org.refcodes.component.Closable
,org.refcodes.component.Closable.CloseBuilder<RestEndpointBuilder>
,org.refcodes.component.ConnectionStatusAccessor
,org.refcodes.net.HttpMethodAccessor
,org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<RestEndpointBuilder>
,org.refcodes.net.HttpMethodAccessor.HttpMethodMutator
,org.refcodes.net.HttpMethodAccessor.HttpMethodProperty
,org.refcodes.component.LinkComponent
,org.refcodes.component.LinkComponent.LinkComponentBuilder<RestEndpointBuilder>
,org.refcodes.component.Openable
,org.refcodes.component.Openable.OpenBuilder<RestEndpointBuilder>
,RestEndpoint
,RestRequestObserver
- All Known Implementing Classes:
RestEndpointBuilderImpl
public interface RestEndpointBuilder extends RestEndpoint, org.refcodes.net.HttpMethodAccessor.HttpMethodProperty, org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<RestEndpointBuilder>, org.refcodes.component.LinkComponent.LinkComponentBuilder<RestEndpointBuilder>, org.refcodes.component.ConnectionStatusAccessor
AnRestEndpointBuilder
extends anRestEndpoint
with builder functionality and addslambda
support for handling the requests addressed to thisRestEndpoint
. Thelambda
defined asRestRequestObserver
acts as the single listener to thisRestEndpoint
responsible for handling the requests for which thisRestEndpoint
is responsible. The locator for which anRestEndpointBuilder
is responsible for is defined by theRestEndpointBuilder
's Locator-Pattern: A single asterisk ("*") matches zero or more characters within a locator name. A double asterisk ("**") matches zero or more characters across directory levels. A question mark ("?") matches exactly one character within a locator name. The single asterisk ("*"), the double asterisk ("**") and the question mark ("?") we refer to as wildcard: You get an array with the substitutes of the wildcards using the methodWildcardSubstitutes.getWildcardReplacements()
. You may name a wildcard by prefixing it with "${someWildcardName}". For example a named wildcard may look as follows: "${arg1}=*" or "${arg2}=**" or "${arg3}=?". You can get the text substituting a named wildcard using the methodWildcardSubstitutes.getWildcardReplacement(String)
. For ease of use, a named wildcard with single asterisk ("*") such as "${arg1}=*" can be abbreviated as "${arg1}".
-
-
Nested Class Summary
-
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.ConnectionStatusAccessor
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.HttpMethodAccessor
org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<B extends org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<B>>, org.refcodes.net.HttpMethodAccessor.HttpMethodMutator, org.refcodes.net.HttpMethodAccessor.HttpMethodProperty
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static RestEndpointBuilder
build()
This is a convenience method for easily instantiating the according builder.RestRequestObserver
getRequestObserver()
Retrieves theRestRequestObserver
to which any requests are delegated upon invocation of theRestRequestObserver.onRequest(RestRequestEvent, org.refcodes.net.HttpServerResponse)
method.void
setLocatorPathPattern(String aLocatorPathPattern)
Sets the resource locator pattern.void
setLocatorRegExp(Pattern aLocatorRegExp)
Sets the resource locator (regular expression) pattern.void
setRequestObserver(RestRequestObserver aLambda)
Sets theRestRequestObserver
to which any requests are delegated upon invocation of theRestRequestObserver.onRequest(RestRequestEvent, org.refcodes.net.HttpServerResponse)
method.default RestEndpointBuilder
withClose()
default RestEndpointBuilder
withCloseIn(int aCloseInMillis)
default RestEndpointBuilder
withCloseQuietly()
default RestEndpointBuilder
withHttpMethod(org.refcodes.net.HttpMethod aHttpMethod)
default RestEndpointBuilder
withLocatorPathPattern(String aLocatorPathPattern)
Sets the resource locator pattern as of the Builder-Pattern.default RestEndpointBuilder
withLocatorRegExp(Pattern aLocatorRegExp)
Sets the resource locator (regular expression) pattern as of the Builder-Pattern.default RestEndpointBuilder
withOpen()
default RestEndpointBuilder
withRequestObserver(RestRequestObserver aLambda)
Builder method for setting theRestRequestObserver
.-
Methods inherited from interface org.refcodes.component.Closable
close, closeIn, closeQuietly, closeUnchecked
-
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
getConnectionStatus, isConnectionOpened
-
Methods inherited from interface org.refcodes.net.HttpMethodAccessor.HttpMethodMutator
setHttpMethod
-
Methods inherited from interface org.refcodes.rest.RestEndpoint
getLocatorPathPattern, getLocatorRegExp
-
Methods inherited from interface org.refcodes.rest.RestRequestObserver
onRequest
-
-
-
-
Method Detail
-
withHttpMethod
default RestEndpointBuilder withHttpMethod(org.refcodes.net.HttpMethod aHttpMethod)
- Specified by:
withHttpMethod
in interfaceorg.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<RestEndpointBuilder>
-
withLocatorPathPattern
default RestEndpointBuilder withLocatorPathPattern(String aLocatorPathPattern)
Sets the resource locator pattern as of the Builder-Pattern. The locator may contain wildcards as known from file-systems as follows: A single asterisk ("*") matches zero or more characters within a locator name. A double asterisk ("**") matches zero or more characters across directory levels. A question mark ("?") matches exactly one character within a locator name. You may name a wildcard by prefixing it with "${someWildcardName}". For example a named wildcard may look as follows: "${arg1}=*" or "${arg2}=**" or "${arg3}=?". You can get the text substituting a named wildcard using the methodWildcardSubstitutes.getWildcardReplacement(String)
. For ease of use, a named wildcard with single asterisk ("*") such as "${arg1}=*" can be abbreviated as "${arg1}".- Parameters:
aLocatorPathPattern
- the locator pattern- Returns:
- The
RestEndpoint
builder to continue configuration (as of the Builder-Pattern).
-
setLocatorPathPattern
void setLocatorPathPattern(String aLocatorPathPattern)
Sets the resource locator pattern. The locator may contain wildcards as known from file-systems as follows: A single asterisk ("*") matches zero or more characters within a locator name. A double asterisk ("**") matches zero or more characters across directory levels. A question mark ("?") matches exactly one character within a locator name. You may name a wildcard by prefixing it with "${someWildcardName}". For example a named wildcard may look as follows: "${arg1}=*" or "${arg2}=**" or "${arg3}=?". You can get the text substituting a named wildcard using the methodWildcardSubstitutes.getWildcardReplacement(String)
. For ease of use, a named wildcard with single asterisk ("*") such as "${arg1}=*" can be abbreviated as "${arg1}".- Parameters:
aLocatorPathPattern
- the new locator pattern
-
withLocatorRegExp
default RestEndpointBuilder withLocatorRegExp(Pattern aLocatorRegExp)
Sets the resource locator (regular expression) pattern as of the Builder-Pattern.- Parameters:
aLocatorRegExp
- the locator (regular expression) pattern- Returns:
- The
RestEndpoint
builder to continue configuration (as of the Builder-Pattern).
-
setLocatorRegExp
void setLocatorRegExp(Pattern aLocatorRegExp)
Sets the resource locator (regular expression) pattern.- Parameters:
aLocatorRegExp
- the new locator (regular expression) pattern
-
getRequestObserver
RestRequestObserver getRequestObserver()
Retrieves theRestRequestObserver
to which any requests are delegated upon invocation of theRestRequestObserver.onRequest(RestRequestEvent, org.refcodes.net.HttpServerResponse)
method.- Returns:
- The (user defined)
RestRequestObserver
to handle requests.
-
setRequestObserver
void setRequestObserver(RestRequestObserver aLambda)
Sets theRestRequestObserver
to which any requests are delegated upon invocation of theRestRequestObserver.onRequest(RestRequestEvent, org.refcodes.net.HttpServerResponse)
method.- Parameters:
aLambda
- The (user defined)RestRequestObserver
to handle requests, feel free to code it aslambda
expression!
-
withRequestObserver
default RestEndpointBuilder withRequestObserver(RestRequestObserver aLambda)
Builder method for setting theRestRequestObserver
.- Parameters:
aLambda
- The (user defined)RestRequestObserver
to handle requests, feel free to code it aslambda
expression- Returns:
- The
RestEndpointBuilder
for the sake of a fluent API.
-
withOpen
default RestEndpointBuilder withOpen() throws org.refcodes.component.OpenException
- Specified by:
withOpen
in interfaceorg.refcodes.component.Openable.OpenBuilder<RestEndpointBuilder>
- Throws:
org.refcodes.component.OpenException
-
withClose
default RestEndpointBuilder withClose() throws org.refcodes.component.CloseException
- Specified by:
withClose
in interfaceorg.refcodes.component.Closable.CloseBuilder<RestEndpointBuilder>
- Throws:
org.refcodes.component.CloseException
-
withCloseQuietly
default RestEndpointBuilder withCloseQuietly()
- Specified by:
withCloseQuietly
in interfaceorg.refcodes.component.Closable.CloseBuilder<RestEndpointBuilder>
-
withCloseIn
default RestEndpointBuilder withCloseIn(int aCloseInMillis)
- Specified by:
withCloseIn
in interfaceorg.refcodes.component.Closable.CloseBuilder<RestEndpointBuilder>
-
build
static RestEndpointBuilder build()
This is a convenience method for easily instantiating the according builder.- Returns:
- an instance (using a default implementation) of this builder
-
-