public class EndpointBuilderImpl extends Object implements EndpointBuilder
EndpointBuilder
interface.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 | Field and Description |
---|---|
protected org.refcodes.net.HttpMethod |
_httpMethod |
protected String |
_locatorPAttern |
protected RequestObserver |
_requestObserver |
Constructor and Description |
---|
EndpointBuilderImpl()
Constructs a plain
EndpointBuilder , make sure to provide the least
required attributes as demonstrated by the constructor
#EndpointImpl(HttpMethod, String, RequestObserver) . |
EndpointBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod,
String aLocator,
RequestObserver aRequestObserver)
Constructs an
EndpointBuilder with the least required attributes. |
Modifier and Type | Method and Description |
---|---|
Object |
execute(RestRequestEvent aContext) |
org.refcodes.net.HttpMethod |
getHttpMethod() |
String |
getLocatorPattern()
Retrieves the resource locator pattern this endpoint has been registered
to.
|
RequestObserver |
getRequestObserver()
Retrieves the
RequestObserver to which any requests are delegated
upon invocation of the #execute(RestRequest) method. |
void |
setHttpMethod(org.refcodes.net.HttpMethod aHttpMethod) |
void |
setLocatorPattern(String aLocatorPattern)
Sets the resource locator.
|
void |
setRequestObserver(RequestObserver aLambda)
Sets the
RequestObserver to which any requests are delegated upon
invocation of the #execute(RestRequest) method. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
withHttpMethod, withLocatorPattern, withRequestObserver
protected RequestObserver _requestObserver
protected org.refcodes.net.HttpMethod _httpMethod
protected String _locatorPAttern
public EndpointBuilderImpl()
EndpointBuilder
, make sure to provide the least
required attributes as demonstrated by the constructor
#EndpointImpl(HttpMethod, String, RequestObserver)
.public EndpointBuilderImpl(org.refcodes.net.HttpMethod aHttpMethod, String aLocator, RequestObserver aRequestObserver)
EndpointBuilder
with the least required attributes.aHttpMethod
- The HTTP method to which this EndpointBuilder
is
bound.aLocator
- The local host's locator to which this EndpointBuilder
is bound.aRequestObserver
- The Command
processing a request targeted
at this EndpointBuilder
.public void setLocatorPattern(String aLocatorPattern)
EndpointBuilder
setLocatorPattern
in interface EndpointBuilder
public void setHttpMethod(org.refcodes.net.HttpMethod aHttpMethod)
setHttpMethod
in interface org.refcodes.net.HttpMethodAccessor.HttpMethodMutator
public void setRequestObserver(RequestObserver aLambda)
EndpointBuilder
RequestObserver
to which any requests are delegated upon
invocation of the #execute(RestRequest)
method.setRequestObserver
in interface EndpointBuilder
aLambda
- The (user defined) RequestObserver
to handle
request, feel free to code it as lambda expression!public RequestObserver getRequestObserver()
EndpointBuilder
RequestObserver
to which any requests are delegated
upon invocation of the #execute(RestRequest)
method.getRequestObserver
in interface EndpointBuilder
RequestObserver
to handle request.public Object execute(RestRequestEvent aContext) throws org.refcodes.net.HttpException
execute
in interface org.refcodes.command.Command<RestRequestEvent,Object,org.refcodes.net.HttpException>
org.refcodes.net.HttpException
public org.refcodes.net.HttpMethod getHttpMethod()
getHttpMethod
in interface org.refcodes.net.HttpMethodAccessor
public String getLocatorPattern()
Endpoint
#toWildcardSubstitutes(String)
(or null, if your String
does not match your locator pattern).
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.
getLocatorPattern
in interface Endpoint
Copyright © 2016. All rights reserved.