Interface Handler


  • public interface Handler
    This is the interface that every business handler should extend from. It has two default methods that can be shared by all handlers.
    Author:
    Steve Hu
    • Method Detail

      • handle

        ByteBuffer handle​(io.undertow.server.HttpServerExchange exchange,
                          Object object)
      • getStatus

        default String getStatus​(io.undertow.server.HttpServerExchange exchange,
                                 String code,
                                 Object... args)
        Return a Status object so that the handler can get the HTTP response code to set exchange response.
        Parameters:
        exchange - HttpServerExchange used to set the response code
        code - Error code defined in status.yml
        args - A number of arguments in the error description
        Returns:
        status Status object
      • getStatus

        default String getStatus​(io.undertow.server.HttpServerExchange exchange,
                                 com.networknt.status.Status status)
        There are situations that the downstream service returns an error status response and we just want to bubble up to the caller and eventually to the original caller.
        Parameters:
        exchange - HttpServerExchange
        status - error status
        Returns:
        String the status string