Package com.github.ambry.rest
Interface RestRequestService
-
public interface RestRequestService
RestRequestService defines a service that handlesRestRequest
. Typically, a RestRequestService is expected to receive requests and handle them as required and either send a response (if immediately available) or pass control to another component that does further handling and generates a response. Most operations are performed async and responses are therefore queued asynchronously instead of being available at the end of the function call. Implementations are expected to be thread-safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
handleDelete(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles a DELETE operation.void
handleGet(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles a GET operation.void
handleHead(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles a HEAD operation.void
handleOptions(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles an OPTIONS request.void
handlePost(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles a POST operation.void
handlePut(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles a PUT operation.void
setupResponseHandler(RestResponseHandler responseHandler)
SetupRestResponseHandler
for thisRestRequestService
.void
shutdown()
Does shutdown tasks for the RestRequestService.void
start()
Does startup tasks for the RestRequestService.
-
-
-
Method Detail
-
setupResponseHandler
void setupResponseHandler(RestResponseHandler responseHandler)
- Parameters:
responseHandler
- theRestResponseHandler
that can be used to submit responses.
-
start
void start() throws java.lang.InstantiationException
Does startup tasks for the RestRequestService. When the function returns, startup is FULLY complete.- Throws:
java.lang.InstantiationException
- if RestRequestService is unable to start.
-
shutdown
void shutdown()
Does shutdown tasks for the RestRequestService. When the function returns, shutdown is FULLY complete.
-
handleGet
void handleGet(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles a GET operation. TherestRequest
provided will have both metadata and any content associated with the request. TherestResponseChannel
can be used to send responses to the client.- Parameters:
restRequest
- theRestRequest
that needs to be handled.restResponseChannel
- theRestResponseChannel
over which response torestRequest
can be sent.
-
handlePost
void handlePost(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles a POST operation. TherestRequest
provided will have both metadata and any content associated with the request. TherestResponseChannel
can be used to send responses to the client.- Parameters:
restRequest
- theRestRequest
that needs to be handled.restResponseChannel
- theRestResponseChannel
over which response torestRequest
can be sent.
-
handlePut
void handlePut(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles a PUT operation. TherestRequest
provided will have both metadata and any content associated with the request. TherestResponseChannel
can be used to send responses to the client.- Parameters:
restRequest
- theRestRequest
that needs to be handled.restResponseChannel
- theRestResponseChannel
over which response torestRequest
can be sent.
-
handleDelete
void handleDelete(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles a DELETE operation. TherestRequest
provided will have both metadata and any content associated with the request. TherestResponseChannel
can be used to send responses to the client.- Parameters:
restRequest
- theRestRequest
that needs to be handled.restResponseChannel
- theRestResponseChannel
over which response torestRequest
can be sent.
-
handleHead
void handleHead(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles a HEAD operation. TherestRequest
provided will have both metadata and any content associated with the request. TherestResponseChannel
can be used to send responses to the client.- Parameters:
restRequest
- theRestRequest
that needs to be handled.restResponseChannel
- theRestResponseChannel
over which response torestRequest
can be sent.
-
handleOptions
void handleOptions(RestRequest restRequest, RestResponseChannel restResponseChannel)
Handles an OPTIONS request. TherestRequest
provided will have both metadata and any content associated with the request. TherestResponseChannel
can be used to send responses to the client.- Parameters:
restRequest
- theRestRequest
that needs to be handled.restResponseChannel
- theRestResponseChannel
over which response torestRequest
can be sent.
-
-