Interface DirectHandler

  • 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 DirectHandler
    A handler that is invoked when a response is sent outside of routing. See DirectHandler.EventType to see which types of events are covered by this handler.
    • Method Detail

      • handle

        default DirectHandler.TransportResponse handle​(DirectHandler.TransportRequest request,
                                                       DirectHandler.EventType eventType,
                                                       Http.ResponseStatus defaultStatus,
                                                       Throwable t)
        Handler of responses that bypass routing, MUST NOT block the current thread.

        This method should be used to return custom status, header and possible entity (retrieved without blocking). If there is a need to handle more details, please redirect the client to a proper endpoint to handle them.

        Parameters:
        request - request as received with as much known information as possible
        eventType - type of the event
        defaultStatus - default status expected to be returned
        t - throwable caught as part of processing with possible additional details about the reason of failure
        Returns:
        response to use to return to original request
      • handle

        DirectHandler.TransportResponse handle​(DirectHandler.TransportRequest request,
                                               DirectHandler.EventType eventType,
                                               Http.ResponseStatus defaultStatus,
                                               String message)
        Handler of responses that bypass routing, MUST NOT block the current thread.

        This method should be used to return custom status, header and possible entity (retrieved without blocking). If there is a need to handle more details, please redirect the client to a proper endpoint to handle them.

        Parameters:
        request - request as received with as much known information as possible
        eventType - type of the event
        defaultStatus - default status expected to be returned
        message - message expected to be used as a response entity - may be an empty string (no entity expected), never null
        Returns:
        response to use to return to original request