org.refcodes.component.Closable
, org.refcodes.component.Closable.CloseBuilder<RestEndpointBuilder>
, org.refcodes.component.ConnectionStatusAccessor
, org.refcodes.web.HttpMethodAccessor
, org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<RestEndpointBuilder>
, org.refcodes.web.HttpMethodAccessor.HttpMethodMutator
, org.refcodes.web.HttpMethodAccessor.HttpMethodProperty
, org.refcodes.component.LinkComponent
, org.refcodes.component.LinkComponent.LinkComponentBuilder<RestEndpointBuilder>
, org.refcodes.component.Openable
, org.refcodes.component.Openable.OpenBuilder<RestEndpointBuilder>
, org.refcodes.component.OpenedAccessor
, RestEndpoint
, RestRequestConsumer
RestEndpointBuilderImpl
public interface RestEndpointBuilder extends RestEndpoint, org.refcodes.web.HttpMethodAccessor.HttpMethodProperty, org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<RestEndpointBuilder>, org.refcodes.component.LinkComponent.LinkComponentBuilder<RestEndpointBuilder>, org.refcodes.component.ConnectionStatusAccessor
RestEndpointBuilder
extends an RestEndpoint
with builder
functionality and adds lambda
support for handling the requests
addressed to this RestEndpoint
. The lambda
defined as
RestRequestConsumer
acts as the single listener to this
RestEndpoint
responsible for handling the requests for which this
RestEndpoint
is responsible. The locator for which an
RestEndpointBuilder
is responsible for is defined by the
RestEndpointBuilder
'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 method RestRequestEvent.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
method RestRequestEvent.getWildcardReplacement(String)
. For ease of
use, a named wildcard with single asterisk ("*") such as "${arg1}=*" can be
abbreviated as "${arg1}".org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<B extends org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<B>>, org.refcodes.web.HttpMethodAccessor.HttpMethodMutator, org.refcodes.web.HttpMethodAccessor.HttpMethodProperty
org.refcodes.component.LinkComponent.LinkAutomaton, org.refcodes.component.LinkComponent.LinkComponentBuilder<B extends org.refcodes.component.LinkComponent.LinkComponentBuilder<B>>
Modifier and Type | Method | Description |
---|---|---|
static RestEndpointBuilder |
build() |
This is a convenience method for easily instantiating the according
builder.
|
RestRequestConsumer |
getRequestObserver() |
Retrieves the
RestRequestConsumer to which any requests are
delegated upon invocation of the
RestRequestConsumer.onRequest(RestRequestEvent, org.refcodes.web.HttpServerResponse)
method. |
void |
setLocatorPathPattern(String aLocatorPathPattern) |
Sets the resource locator pattern.
|
void |
setLocatorRegExp(Pattern aLocatorRegExp) |
Sets the resource locator (regular expression) pattern.
|
void |
setRequestObserver(RestRequestConsumer aLambda) |
Sets the
RestRequestConsumer to which any requests are delegated
upon invocation of the
RestRequestConsumer.onRequest(RestRequestEvent, org.refcodes.web.HttpServerResponse)
method. |
default RestEndpointBuilder |
withClose() |
|
default RestEndpointBuilder |
withCloseIn(int aCloseInMillis) |
|
default RestEndpointBuilder |
withCloseQuietly() |
|
default RestEndpointBuilder |
withHttpMethod(org.refcodes.web.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(RestRequestConsumer aLambda) |
Builder method for setting the
RestRequestConsumer . |
close, closeIn, closeQuietly, closeUnchecked
getConnectionStatus, isOpened
setHttpMethod
letHttpMethod
getLocatorPathPattern, getLocatorRegExp
onRequest
default RestEndpointBuilder withHttpMethod(org.refcodes.web.HttpMethod aHttpMethod)
withHttpMethod
in interface org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<RestEndpointBuilder>
default RestEndpointBuilder withLocatorPathPattern(String aLocatorPathPattern)
RestRequestEvent.getWildcardReplacement(String)
. For ease of use,
a named wildcard with single asterisk ("*") such as "${arg1}=*" can be
abbreviated as "${arg1}".aLocatorPathPattern
- the locator patternRestEndpoint
builder to continue configuration (as of
the Builder-Pattern).void setLocatorPathPattern(String aLocatorPathPattern)
RestRequestEvent.getWildcardReplacement(String)
. For ease of use,
a named wildcard with single asterisk ("*") such as "${arg1}=*" can be
abbreviated as "${arg1}".aLocatorPathPattern
- the new locator patterndefault RestEndpointBuilder withLocatorRegExp(Pattern aLocatorRegExp)
aLocatorRegExp
- the locator (regular expression) patternRestEndpoint
builder to continue configuration (as of
the Builder-Pattern).void setLocatorRegExp(Pattern aLocatorRegExp)
aLocatorRegExp
- the new locator (regular expression) patternRestRequestConsumer getRequestObserver()
RestRequestConsumer
to which any requests are
delegated upon invocation of the
RestRequestConsumer.onRequest(RestRequestEvent, org.refcodes.web.HttpServerResponse)
method.RestRequestConsumer
to handle
requests.void setRequestObserver(RestRequestConsumer aLambda)
RestRequestConsumer
to which any requests are delegated
upon invocation of the
RestRequestConsumer.onRequest(RestRequestEvent, org.refcodes.web.HttpServerResponse)
method.aLambda
- The (user defined) RestRequestConsumer
to handle
requests, feel free to code it as lambda
expression!default RestEndpointBuilder withRequestObserver(RestRequestConsumer aLambda)
RestRequestConsumer
.aLambda
- The (user defined) RestRequestConsumer
to handle
requests, feel free to code it as lambda
expressionRestEndpointBuilder
for the sake of a fluent API.default RestEndpointBuilder withOpen() throws IOException
withOpen
in interface org.refcodes.component.Openable.OpenBuilder<RestEndpointBuilder>
IOException
default RestEndpointBuilder withClose() throws IOException
withClose
in interface org.refcodes.component.Closable.CloseBuilder<RestEndpointBuilder>
IOException
default RestEndpointBuilder withCloseQuietly()
withCloseQuietly
in interface org.refcodes.component.Closable.CloseBuilder<RestEndpointBuilder>
default RestEndpointBuilder withCloseIn(int aCloseInMillis)
withCloseIn
in interface org.refcodes.component.Closable.CloseBuilder<RestEndpointBuilder>
static RestEndpointBuilder build()
Copyright © 2021. All rights reserved.