Interface LightHttpHandler

  • All Superinterfaces:
    io.undertow.server.HttpHandler
    All Known Subinterfaces:
    MiddlewareHandler
    All Known Implementing Classes:
    OrchestrationHandler

    public interface LightHttpHandler
    extends io.undertow.server.HttpHandler
    This is an extension of HttpHandler that provides a default method to handle error status. All API handler should extend from this interface.
    Author:
    Steve Hu
    • Method Detail

      • setExchangeStatus

        default void setExchangeStatus​(io.undertow.server.HttpServerExchange exchange,
                                       String code,
                                       Object... args)
        This method is used to construct a standard error status in JSON format from an error code.
        Parameters:
        exchange - HttpServerExchange
        code - error code
        args - arguments for error description
      • setExchangeStatus

        default void setExchangeStatus​(io.undertow.server.HttpServerExchange exchange,
                                       String code,
                                       Map<String,​Object> metadata,
                                       Object... args)
        This method is used to construct a standard error status with metadata in JSON format from an error code.
        Parameters:
        exchange - HttpServerExchange
        code - error code
        metadata - additional metadata info
        args - arguments for error description
      • setExchangeStatus

        default void setExchangeStatus​(io.undertow.server.HttpServerExchange exchange,
                                       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