Class ThrowableProcessor

java.lang.Object
org.apache.juneau.rest.server.processor.ThrowableProcessor
All Implemented Interfaces:
ResponseProcessor

public class ThrowableProcessor extends Object implements ResponseProcessor
Response handler for Throwable objects.

Adds a Thrown header (exception class name and message) to the response and returns 0 so that the processor chain can continue.

The header is only added when the exception was deliberately thrown for a client audience (a BasicHttpException or a class annotated with @Response), when renderResponseStackTraces is enabled, or when the operation is an RRPC dispatch target (the @Remote client relies on the header to reconstruct the exception type). Any other, unplanned exception keeps its class name and message out of the response by default.

See Also:

  • Constructor Details

  • Method Details

    • process

      public int process(RestOpSession opSession) throws IOException
      Description copied from interface: ResponseProcessor
      Process this response if possible.
      Specified by:
      process in interface ResponseProcessor
      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 a HttpServletResponse.SC_INTERNAL_SERVER_ERROR error.