Interface HandlerContext


  • public interface HandlerContext
    Handler context represents a present state of all handlers placed in execution chain. There are two basic operations located in this type - first allows to continue execution and let next handler be called. Second is intended to break the chain and force handlers to process error and generate error response. When Handler decide to not call context by delegating further handler to get called via execute(HttpServletRequest, HttpServletResponse) nor error(Exception) then chain is stopped. By this simple way handlers can decide to hold processing and generate own response.
    Author:
    Ɓukasz Dywicki - Initial contribution
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void error​(Exception error)
      Signal that an error occurred during handling of request.
      void execute​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Delegate execution to next handler in the chain, if available.
      boolean hasError()
      Checks if has any errors occurred while handling request.
    • Method Detail

      • execute

        void execute​(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)
        Delegate execution to next handler in the chain, if available. When current handler is last in processing queue then nothing happens, execution chain returns to its caller.
        Parameters:
        request - Request.
        response - Response.
      • error

        void error​(Exception error)
        Signal that an error occurred during handling of request. Call to this method will break normal execution chain and force handling of error.
      • hasError

        boolean hasError()
        Checks if has any errors occurred while handling request.
        Returns:
        True if an exception occurred while handling request.