- All Superinterfaces:
org.refcodes.web.HttpMethodAccessor
,RestRequestConsumer
- All Known Implementing Classes:
RestEndpointBuilder
An
RestEndpoint
subscribes to a RestfulServer
(
RestfulHttpServer
) 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
RestRequestConsumer
responsible for processing the request. The
RestRequestConsumer
is invoked as soon as a request with the given
HttpMethod
for a locator matching the given Locator-Pattern is being
processed by the RestfulServer
( RestfulHttpServer
). 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
RestRequestEvent.getWildcardReplacements()
inside the
RestRequestConsumer.onRequest(RestRequestEvent, org.refcodes.web.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}?".-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.web.HttpMethodAccessor
org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<B extends org.refcodes.web.HttpMethodAccessor.HttpMethodBuilder<B>>, org.refcodes.web.HttpMethodAccessor.HttpMethodMutator, org.refcodes.web.HttpMethodAccessor.HttpMethodProperty
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the resource Locator-Pattern this endpoint has been registered to.Retrieves the resource locator (regular expression) pattern this endpoint has been registered to.Methods inherited from interface org.refcodes.web.HttpMethodAccessor
getHttpMethod
Methods inherited from interface org.refcodes.rest.RestRequestConsumer
onRequest
-
Method Details
-
getLocatorPathPattern
String getLocatorPathPattern()Retrieves the resource Locator-Pattern this endpoint has been registered to. The Locator-Pattern 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. 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 theRestRequestEvent
's methodRestRequestEvent.getWildcardReplacements()
inside theRestRequestConsumer.onRequest(RestRequestEvent, org.refcodes.web.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}?". TheRestRequestEvent
lets you access the wildcard substitutes either by index or by name. -
getLocatorRegExp
Pattern getLocatorRegExp()Retrieves the resource locator (regular expression) pattern this endpoint has been registered to. TheRestRequestEvent
lets you access the matching regular expression groups either by index or by name.
-