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.
|
RestRequest |
createRequest(HttpServletRequest req)
Creates a
RestRequest object based on the specified incoming HttpServletRequest object. |
RestResponse |
createResponse(RestRequest req,
HttpServletResponse res)
Creates a
RestResponse object based on the specified incoming HttpServletResponse object
and the request returned by createRequest(HttpServletRequest) . |
Map<String,Object> |
getSessionObjects(RestRequest req,
RestResponse res)
Returns the session objects for the specified request.
|
void |
handleError(HttpServletRequest req,
HttpServletResponse res,
Throwable e)
Method for handling response errors.
|
void |
handleNotFound(int rc,
RestRequest req,
RestResponse res)
Handle the case where a matching method was not found.
|
void |
handleResponse(RestRequest req,
RestResponse res)
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.
|
RestRequest createRequest(HttpServletRequest req) throws ServletException
RestRequest
object based on the specified incoming HttpServletRequest
object.req
- The request object from the service(HttpServletRequest, HttpServletResponse)
method.ServletException
- If any errors occur trying to interpret the request.RestResponse createResponse(RestRequest req, HttpServletResponse res) throws ServletException
RestResponse
object based on the specified incoming HttpServletResponse
object
and the request returned by createRequest(HttpServletRequest)
.req
- The request object returned by createRequest(HttpServletRequest)
.res
- The response object from the service(HttpServletRequest, HttpServletResponse)
method.ServletException
- If any errors occur trying to interpret the request or response.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.void handleResponse(RestRequest req, RestResponse res) throws Exception
RestResponse.setOutput(Object)
method or
returned by the Java method.req
- The HTTP request.res
- The HTTP response.Exception
- Can be thrown if error occurred while handling response.void handleNotFound(int rc, RestRequest req, RestResponse res) throws Exception
rc
- The HTTP response code.req
- The HTTP request.res
- The HTTP response.Exception
- Can be thrown if error occurred while handling response.void handleError(HttpServletRequest req, HttpServletResponse res, Throwable e) throws Exception
req
- The servlet request.res
- The servlet response.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.