Interface RouteHandler

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface RouteHandler
    Handler that is associated with a mounted route. Note that this is a functional interface and so can be implemented as a lambda. See examples in RouteGroup
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object handle​(RequestContext req, javax.servlet.http.HttpServletResponse resp)
      Called when a the route this handler is attached to is matched in an incoming HTTP request.
    • Method Detail

      • handle

        java.lang.Object handle​(RequestContext req,
                                javax.servlet.http.HttpServletResponse resp)
                         throws java.lang.Exception
        Called when a the route this handler is attached to is matched in an incoming HTTP request.
        Returns:
        Return an object if your handler should result in a string body returned. Optionally transform the object if it is not already a string by adding a ResponseRenderer to your mounted route. Return null if you have handled the response yourself by directly manipulating the HttpServletResponse.
        Throws:
        java.lang.Exception