Interface ResponseProcessor
- All Known Implementing Classes:
HttpEntityProcessor
,HttpResourceProcessor
,HttpResponseProcessor
,InputStreamProcessor
,PlainTextPojoProcessor
,ReaderProcessor
,ResponseBeanProcessor
,SerializedPojoProcessor
,ThrowableProcessor
The REST Server API uses the concept of registered response processors for converting objects returned by REST
methods or set through RestResponse.setContent(Object)
into appropriate HTTP responses.
Response processors can be associated with REST resources via the following:
Response processors can be used to process POJOs that cannot normally be handled through Juneau serializers, or because it's simply easier to define response processors for special cases.
The following example shows how to create a response processor to handle special
See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Return code indicating that processing is complete and to exit the chain.static final int
Return code indicating to proceed to the next response processor in the chain.static final int
Return code indicating to restart processing the chain from the beginning. -
Method Summary
Modifier and TypeMethodDescriptionint
process
(RestOpSession opSession) Process this response if possible.
-
Field Details
-
NEXT
Return code indicating to proceed to the next response processor in the chain.- See Also:
-
FINISHED
Return code indicating that processing is complete and to exit the chain.- See Also:
-
RESTART
Return code indicating to restart processing the chain from the beginning.- See Also:
-
-
Method Details
-
process
Process this response if possible.- Parameters:
opSession
- The HTTP call.- Returns:
- One of the following codes:
0 - The processor could not handle the request.1 - The processor was able to fully handle the request.2 - The processor was able to partially handle the request by replacing the output. The response processors should start over.
- Throws:
IOException
- If low-level exception occurred on output stream.
Results in aHttpServletResponse.SC_INTERNAL_SERVER_ERROR
error.BasicHttpException
- If some other exception occurred.
Can be used to provide an appropriate HTTP response code and message.
-