public interface RestCallHandler
Modifier and Type | Interface and Description |
---|---|
static interface |
RestCallHandler.Null
Represents no RestCallHandler.
|
Modifier and Type | Method and Description |
---|---|
RestRequest |
createRequest(javax.servlet.http.HttpServletRequest req)
Creates a
RestRequest object based on the specified incoming HttpServletRequest object. |
RestResponse |
createResponse(RestRequest req,
javax.servlet.http.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)
Returns the session objects for the specified request.
|
void |
handleError(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
RestException 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,
Object output)
The main method for serializing POJOs passed in through the
RestResponse.setOutput(Object) method or
returned by the Java method. |
void |
renderError(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
RestException e)
Method for rendering response errors.
|
void |
service(javax.servlet.http.HttpServletRequest r1,
javax.servlet.http.HttpServletResponse r2)
The main service method.
|
RestRequest createRequest(javax.servlet.http.HttpServletRequest req) throws javax.servlet.ServletException
RestRequest
object based on the specified incoming HttpServletRequest
object.req
- The request object from the service(HttpServletRequest, HttpServletResponse)
method.javax.servlet.ServletException
- If any errors occur trying to interpret the request.RestResponse createResponse(RestRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.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.javax.servlet.ServletException
- If any errors occur trying to interpret the request or response.void service(javax.servlet.http.HttpServletRequest r1, javax.servlet.http.HttpServletResponse r2) throws javax.servlet.ServletException, IOException
r1
- The incoming HTTP servlet request object.r2
- The incoming HTTP servlet response object.javax.servlet.ServletException
IOException
void handleResponse(RestRequest req, RestResponse res, Object output) throws IOException, RestException
RestResponse.setOutput(Object)
method or
returned by the Java method.req
- The HTTP request.res
- The HTTP response.output
- The output to serialize in the response.IOException
RestException
void handleNotFound(int rc, RestRequest req, RestResponse res) throws Exception
rc
- The HTTP response code.req
- The HTTP request.res
- The HTTP response.Exception
void handleError(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, RestException e) throws IOException
req
- The servlet request.res
- The servlet response.e
- The exception that occurred.IOException
- Can be thrown if a problem occurred trying to write to the output stream.void renderError(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, RestException e) throws IOException
req
- The servlet request.res
- The servlet response.e
- The exception that occurred.IOException
- Can be thrown if a problem occurred trying to write to the output stream.Map<String,Object> getSessionObjects(RestRequest req)
req
- The REST request.Copyright © 2018 Apache. All rights reserved.