public class RestRequestHandler extends java.lang.Object implements RequestHandler
The endpoint that handles the request is the endpoint with the most specific URI that matches the request. With two
endpoints at /api/*
and /api/my/endpoint
, the second is used when requesting
/api/my/endpoint
and the first is used when requesting /api/my/endpoint/and/extension
because the second is not a global endpoint.
Constructor and Description |
---|
RestRequestHandler()
Constructs a REST request handler with no endpoint.
|
Modifier and Type | Method and Description |
---|---|
void |
addEndpoint(RestEndpoint endpoint)
Adds an endpoint to this handler.
|
HTTPResponse |
process(HTTPRequest request,
java.util.Map<java.lang.String,java.lang.String> attributes)
Processes the request and creates the appropriate response, or null if this request handler doesn't match the
request.
|
public RestRequestHandler()
addEndpoint(RestEndpoint)
public void addEndpoint(RestEndpoint endpoint)
endpoint
- the endpoint to add.public HTTPResponse process(HTTPRequest request, java.util.Map<java.lang.String,java.lang.String> attributes)
RequestHandler
process
in interface RequestHandler
request
- the HTTPRequest
to process.attributes
- the attributes of the request.HTTPResponse
to send, or null if not handled by this RequestHandler
.