org.refcodes.net.HttpMethodAccessor, RestRequestObserverRestEndpointBuilderRestEndpointBuilderImplpublic interface RestEndpoint extends RestRequestObserver, org.refcodes.net.HttpMethodAccessor
RestEndpoint subscribes to a RestServer (
HttpRestServer) and defines the target for a REST request. Therefore
the RestEndpoint describes the HttpMethod, the locator
(pattern) to which to respond as well as a RestRequestObserver
responsible for processing the request. The RestRequestObserver is
invoked as soon as a request with the given HttpMethod for a locator
matching the given Locator-Pattern is being processed by the
RestServer ( HttpRestServer).
The locator for which an RestEndpoint is responsible for is defined
by the RestEndpoint'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 RestRequestEvent's method
WildcardSubstitutes.getWildcardReplacements() inside the
RestRequestObserver.onRequest(RestRequestEvent, org.refcodes.net.HttpServerResponse)
method.
You may name a wildcard by prefixing it with "{someWildcardName}". For
example a named wildcard may look as follows: "{arg1}*" or "{arg2}**" or
"{arg3}?".org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<B extends org.refcodes.net.HttpMethodAccessor.HttpMethodBuilder<B>>, org.refcodes.net.HttpMethodAccessor.HttpMethodMutator, org.refcodes.net.HttpMethodAccessor.HttpMethodProperty| Modifier and Type | Method | Description |
|---|---|---|
String |
getLocatorPattern() |
Retrieves the resource Locator-Pattern this endpoint has been registered
to.
|
onRequestString getLocatorPattern()
RestRequestEvent's method
WildcardSubstitutes.getWildcardReplacements() inside the
RestRequestObserver.onRequest(RestRequestEvent, org.refcodes.net.HttpServerResponse)
method.
You may name a wildcard by prefixing it with "{someWildcardName}". For
example a named wildcard may look as follows: "{arg1}*" or "{arg2}**" or
"{arg3}?".
The RestRequestEvent lets you access the wildcard substitutes
either by index or by name.
Copyright © 2018. All rights reserved.