Package com.networknt.handler
Interface LightHttpHandler
- All Superinterfaces:
io.undertow.server.HttpHandler
- All Known Subinterfaces:
Interceptor,MiddlewareHandler,RequestInterceptor,ResponseInterceptor
- All Known Implementing Classes:
OrchestrationHandler,RequestInterceptorInjectionHandler,ResponseInterceptorInjectionHandler
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
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voidsetExchangeStatus(io.undertow.server.HttpServerExchange ex, 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.default voidsetExchangeStatus(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.default voidsetExchangeStatus(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.Methods inherited from interface io.undertow.server.HttpHandler
handleRequest
-
Field Details
-
logger
static final org.slf4j.Logger logger -
ERROR_NOT_DEFINED
- See Also:
-
CONFIG_NAME
- See Also:
-
AUDIT_CONFIG_NAME
- See Also:
-
AUDIT_ON_ERROR
- See Also:
-
AUDIT_STACK_TRACE
- See Also:
-
config
-
auditConfig
-
auditOnError
static final boolean auditOnError -
auditStackTrace
static final boolean auditStackTrace
-
-
Method Details
-
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- HttpServerExchangecode- error codeargs- 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- HttpServerExchangecode- error codemetadata- additional metadata infoargs- arguments for error description
-
setExchangeStatus
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:
ex- HttpServerExchangestatus- error status
-