本文整理汇总了Java中io.undertow.server.handlers.ResponseCodeHandler类的典型用法代码示例。如果您正苦于以下问题:Java ResponseCodeHandler类的具体用法?Java ResponseCodeHandler怎么用?Java ResponseCodeHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResponseCodeHandler类属于io.undertow.server.handlers包,在下文中一共展示了ResponseCodeHandler类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleRequest
import io.undertow.server.handlers.ResponseCodeHandler; //导入依赖的package包/类
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
if (Methods.POST.equals(exchange.getRequestMethod())) {
ResponseCodeHandler.HANDLE_405.handleRequest(exchange);
return;
}
String origReqPath = exchange.getRelativePath();
String remapped = remapper.remapPath(origReqPath);
if (remapped == null) {
ResponseCodeHandler.HANDLE_404.handleRequest(exchange);
return;
}
exchange.setRelativePath(remapped);
// Note: we only change the relative path, not other exchange data that
// incorporates it (like getRequestPath(), getRequestURL()) and not the
// resolved path. If this request gets to DomainApiHandler, it should
// work off the relative path. Other handlers in between may need the
// original data.
next.handleRequest(exchange);
}
示例2: build
import io.undertow.server.handlers.ResponseCodeHandler; //导入依赖的package包/类
@Override
public HandlerWrapper build(final Map<String, Object> config) {
final Integer value = (Integer) config.get("value");
return new HandlerWrapper() {
@Override
public HttpHandler wrap(HttpHandler handler) {
return new ResponseCodeHandler(value);
}
};
}
示例3: proxyHandler
import io.undertow.server.handlers.ResponseCodeHandler; //导入依赖的package包/类
/**
* Returns a handler that can act as a load balancing reverse proxy.
*
* @param proxyClient The proxy client to use to connect to the remote server
* @return The proxy handler
*/
public static ProxyHandler proxyHandler(ProxyClient proxyClient) {
return new ProxyHandler(proxyClient, ResponseCodeHandler.HANDLE_404);
}
示例4: WebSocketProtocolHandshakeHandler
import io.undertow.server.handlers.ResponseCodeHandler; //导入依赖的package包/类
/**
* Create a new {@link WebSocketProtocolHandshakeHandler}
*
* @param callback The {@link WebSocketConnectionCallback} which will be executed once the handshake was
* established
*/
public WebSocketProtocolHandshakeHandler(final WebSocketConnectionCallback callback) {
this(callback, ResponseCodeHandler.HANDLE_404);
}