Interface HttpRouteHandler

  • 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 HttpRouteHandler
    A route handler, meant to process incoming HTTP requests matching some set of preconditions.
    • Method Detail

      • handle

        Future<?> handle​(HttpServiceRequest request,
                         HttpServiceResponse response)
                  throws java.lang.Exception
        Called with an incoming HTTP request and a response handler.
        Parameters:
        request - Information about the incoming HTTP request, including its header and body.
        response - An object useful for indicating how the request is to be responded to. It is an error for a route handler not to set a status code.
        Returns:
        Future completed when handling is complete.
        Throws:
        java.lang.Exception - Whatever exception the handle may want to throw. If the HTTP service owning this handle knows how to translate the exception into a certain kind of HTTP response, it should. Otherwise the requester should receive a 500 Internal Server Error response without any details and the exception be logged (if logging is enabled).