Class ExceptionEvent

All Implemented Interfaces:
Serializable

public class ExceptionEvent extends RequestContextAwareEvent
The ExceptionEvent event class.

Event triggered when unhandled exception occurs. Listener for this event can create a ResponseEntity used later to build HTTP response.

See Also:
  • Field Details

  • Constructor Details

    • ExceptionEvent

      public ExceptionEvent(Object source, Exception exception, HttpServletRequest request, HttpServletResponse response)
      Constructs the event.
      Parameters:
      source - the object on which the event initially occurred
      exception - raised exception
      request - current HTTP request
      response - current HTTP response
  • Method Details

    • getException

      public Exception getException()
      Returns:
      exception which triggered this event
    • getResponseEntity

      public ResponseEntity getResponseEntity()
      Returns:
      response entity to build the HTTP response for this exception
    • setResponseEntity

      public void setResponseEntity(ResponseEntity responseEntity)
      Sets response entity to build the HTTP response for this exception.
      Parameters:
      responseEntity - response entity object
    • hasResponseEntity

      public boolean hasResponseEntity()
      Checks if this event has the response entity defined.
      Returns:
      true if this event has the response entity defined