Interface Handler<Request extends javax.servlet.ServletRequest,Response extends javax.servlet.ServletResponse>

Type Parameters:
Request - Type of ServletRequest.
Response - Type of ServletResponse.
All Known Implementing Classes:
BaseURLAttributeSetter, HttpMiddleware, HttpRouter, Middleware, Router

public interface Handler<Request extends javax.servlet.ServletRequest,Response extends javax.servlet.ServletResponse>
Represents component that handles requests. Can be registered in Router which is also a handler.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    handle(Request request, Response response)
    Handles request.
    boolean
    Determines whether handler should be called when full request path matches or not.
    void
    Sets path parameters.
  • Method Details

    • handle

      boolean handle(Request request, Response response) throws Exception
      Handles request.
      Parameters:
      request - Request to be handled.
      response - Response to be handled.
      Returns:
      Determines whether handlers chain should continue or not.
      Throws:
      Exception
    • setPathParams

      void setPathParams(Map<String,String> pathParams)
      Sets path parameters.
      Parameters:
      pathParams - Map of path parameters.
    • matchesFullPath

      boolean matchesFullPath()
      Determines whether handler should be called when full request path matches or not.
      Returns:
      True indicates that full request path should match path of handler. False indicates that just start of request path should match path of handler.