public interface RestCallHandler
Modifier and Type | Interface and Description |
---|---|
static interface |
RestCallHandler.Null
Represents no RestCallHandler.
|
Modifier and Type | Method and Description |
---|---|
Throwable |
convertThrowable(Throwable t)
Method for converting thrown exceptions into other types before they are handled.
|
RestCall |
createCall(HttpServletRequest req,
HttpServletResponse res)
Wraps an incoming servlet request/response pair into a single
RestCall object. |
RestRequest |
createRequest(RestCall call)
Creates a
RestRequest object based on the specified incoming HttpServletRequest object. |
RestResponse |
createResponse(RestCall call)
Creates a
RestResponse object based on the specified incoming HttpServletResponse object
and the request returned by createRequest(RestCall) . |
Map<String,Object> |
getSessionObjects(RestRequest req,
RestResponse res)
Returns the session objects for the specified request.
|
void |
handleError(RestCall call,
Throwable e)
Method for handling response errors.
|
void |
handleNotFound(RestCall call)
Handle the case where a matching method was not found.
|
void |
handleResponse(RestCall call)
The main method for serializing POJOs passed in through the
RestResponse.setOutput(Object) method or
returned by the Java method. |
void |
service(HttpServletRequest r1,
HttpServletResponse r2)
The main service method.
|
void service(HttpServletRequest r1, HttpServletResponse r2) throws ServletException, IOException
r1
- The incoming HTTP servlet request object.r2
- The incoming HTTP servlet response object.ServletException
- Error occurred.IOException
- Thrown by underlying stream.RestCall createCall(HttpServletRequest req, HttpServletResponse res)
RestCall
object.req
- The rest request.res
- The rest response.RestRequest createRequest(RestCall call) throws ServletException
RestRequest
object based on the specified incoming HttpServletRequest
object.call
- The current REST call.ServletException
- If any errors occur trying to interpret the request.RestResponse createResponse(RestCall call) throws ServletException
RestResponse
object based on the specified incoming HttpServletResponse
object
and the request returned by createRequest(RestCall)
.call
- The current REST call.ServletException
- If any errors occur trying to interpret the request or response.void handleResponse(RestCall call) throws Exception
RestResponse.setOutput(Object)
method or
returned by the Java method.call
- The current REST call.Exception
- Can be thrown if error occurred while handling response.void handleNotFound(RestCall call) throws Exception
call
- The current REST call.Exception
- Can be thrown if error occurred while handling response.void handleError(RestCall call, Throwable e) throws Exception
call
- The current REST call.e
- The exception that occurred.Exception
- Can be thrown if error occurred while handling response.Throwable convertThrowable(Throwable t)
t
- The thrown object.Map<String,Object> getSessionObjects(RestRequest req, RestResponse res)
req
- The REST request.res
- The REST response.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.