Interface Handler


  • public interface Handler
    Handler which is responsible for processing request and response. This type is introduced to provide a unified way for injecting various logic on verification of requests sent via HTTP. Handlers are called before servlet who will receive request, thus they can not mutate servlet response, but they can generate its own response depending on actual needs. Pay attention to error handling - as a proper executions might report exceptions, but fault path handled in method must remain silent and take care of all issues which might occur while handling error.
    Author:
    Ɓukasz Dywicki - Initial contribution
    • Method Detail

      • getPriority

        int getPriority()
        Returns priority of this handler. Priority is any integer where 0 means earliest in the queue. The higher the number is, the later Handler will be called.
        Returns:
        Handler execution priority.
      • handle

        void handle​(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response,
                    HandlerContext context)
             throws Exception
        Method dedicated for processing incoming request and checking its contents.
        Parameters:
        request - Http request.
        response - Http response.
        context - Handler execution context.
        Throws:
        Exception - any error reported during processing will suspend execution of following handlers. Handlers will be then asked to handle error via handleError(HttpServletRequest, HttpServletResponse, HandlerContext) method.