Package ej.restserver.endpoint
Class AliasEndpoint
- java.lang.Object
-
- ej.restserver.RestEndpoint
-
- ej.restserver.endpoint.AliasEndpoint
-
public class AliasEndpoint extends RestEndpoint
An endpoint forwarding its requests to anotherRestEndpoint.
-
-
Field Summary
-
Fields inherited from class ej.restserver.RestEndpoint
uri
-
-
Constructor Summary
Constructors Constructor Description AliasEndpoint(String uri, RestEndpoint endpoint)Instantiates aAliasEndpoint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HTTPResponsedelete(HTTPRequest request, Map<String,String> headers, Map<String,String> parameters)HandlesDELETErequest on this endpoint.HTTPResponseget(HTTPRequest request, Map<String,String> headers, Map<String,String> parameters)HandlesGETrequest on this endpoint.RestEndpointgetEndpoint()Gets the endpoint.HTTPResponsepost(HTTPRequest request, Map<String,String> headers, Map<String,String> parameters)HandlesPOSTrequest on this endpoint.HTTPResponseput(HTTPRequest request, Map<String,String> headers, Map<String,String> parameters)HandlesPUTrequest on this endpoint.voidsetEndpoint(RestEndpoint endpoint)Sets the endpoint.-
Methods inherited from class ej.restserver.RestEndpoint
getURI
-
-
-
-
Constructor Detail
-
AliasEndpoint
public AliasEndpoint(String uri, RestEndpoint endpoint)
Instantiates aAliasEndpoint.- Parameters:
uri- the uri, cannot benull.endpoint- the end point to forward the request to, cannot benull.- Throws:
IllegalArgumentException- if URI is empty
-
-
Method Detail
-
getEndpoint
public RestEndpoint getEndpoint()
Gets the endpoint.- Returns:
- the endpoint.
-
setEndpoint
public void setEndpoint(RestEndpoint endpoint)
Sets the endpoint.- Parameters:
endpoint- the endpoint to set, cannot benull.
-
get
public HTTPResponse get(HTTPRequest request, Map<String,String> headers, Map<String,String> parameters)Description copied from class:RestEndpointHandlesGETrequest on this endpoint.Default implementation return a a status code
501- Overrides:
getin classRestEndpoint- Parameters:
request- the request to handle.headers- request headers.parameters- parsed query and body parameters.- Returns:
- an HTTP response.
-
post
public HTTPResponse post(HTTPRequest request, Map<String,String> headers, Map<String,String> parameters)Description copied from class:RestEndpointHandlesPOSTrequest on this endpoint.Default implementation return a a status code
501- Overrides:
postin classRestEndpoint- Parameters:
request- the request to handle.headers- request headers.parameters- parsed query and body parameters.- Returns:
- an HTTP response.
-
put
public HTTPResponse put(HTTPRequest request, Map<String,String> headers, Map<String,String> parameters)Description copied from class:RestEndpointHandlesPUTrequest on this endpoint.Default implementation return a a status code
501- Overrides:
putin classRestEndpoint- Parameters:
request- the request to handle.headers- request headers.parameters- parsed query and body parameters.- Returns:
- an HTTP response.
-
delete
public HTTPResponse delete(HTTPRequest request, Map<String,String> headers, Map<String,String> parameters)Description copied from class:RestEndpointHandlesDELETErequest on this endpoint.Default implementation return a a status code
501- Overrides:
deletein classRestEndpoint- Parameters:
request- the request to handle.headers- request headers.parameters- parsed query and body parameters.- Returns:
- an HTTP response.
-
-