Package com.networknt.rpc
Interface Handler
-
public interface HandlerThis 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
-
-
Field Summary
Fields Modifier and Type Field Description static StringERROR_NOT_DEFINEDstatic org.slf4j.Loggerloggerstatic StringREQUEST_SUCCESSstatic StringSTATUS_VALIDATION_ERROR
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default StringgetStatus(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.default StringgetStatus(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.ByteBufferhandle(io.undertow.server.HttpServerExchange exchange, Object object)default ByteBuffervalidate(String serviceId, Object object)
-
-
-
Field Detail
-
logger
static final org.slf4j.Logger logger
-
REQUEST_SUCCESS
static final String REQUEST_SUCCESS
- See Also:
- Constant Field Values
-
ERROR_NOT_DEFINED
static final String ERROR_NOT_DEFINED
- See Also:
- Constant Field Values
-
STATUS_VALIDATION_ERROR
static final String STATUS_VALIDATION_ERROR
- See Also:
- Constant Field Values
-
-
Method Detail
-
handle
ByteBuffer handle(io.undertow.server.HttpServerExchange exchange, Object object)
-
validate
default ByteBuffer validate(String serviceId, 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 codecode- Error code defined in status.ymlargs- 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- HttpServerExchangestatus- error status- Returns:
- String the status string
-
-