Package com.networknt.handler
Interface LightHttpHandler
-
- All Superinterfaces:
io.undertow.server.HttpHandler
- All Known Subinterfaces:
MiddlewareHandler
- All Known Implementing Classes:
OrchestrationHandler
public interface LightHttpHandler extends io.undertow.server.HttpHandlerThis 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 Modifier and Type Field Description static StringAUDIT_CONFIG_NAMEstatic StringAUDIT_ON_ERRORstatic StringAUDIT_STACK_TRACEstatic Map<String,Object>auditConfigstatic booleanauditOnErrorstatic booleanauditStackTracestatic HandlerConfigconfigstatic StringCONFIG_NAMEstatic StringERROR_NOT_DEFINEDstatic org.slf4j.Loggerlogger
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidsetExchangeStatus(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.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.
-
-
-
Field Detail
-
logger
static final org.slf4j.Logger logger
-
ERROR_NOT_DEFINED
static final String ERROR_NOT_DEFINED
- See Also:
- Constant Field Values
-
CONFIG_NAME
static final String CONFIG_NAME
- See Also:
- Constant Field Values
-
AUDIT_CONFIG_NAME
static final String AUDIT_CONFIG_NAME
- See Also:
- Constant Field Values
-
AUDIT_ON_ERROR
static final String AUDIT_ON_ERROR
- See Also:
- Constant Field Values
-
AUDIT_STACK_TRACE
static final String AUDIT_STACK_TRACE
- See Also:
- Constant Field Values
-
config
static final HandlerConfig config
-
auditOnError
static final boolean auditOnError
-
auditStackTrace
static final boolean auditStackTrace
-
-
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- 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
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- HttpServerExchangestatus- error status
-
-