use of org.apache.hc.core5.http.nio.support.BasicServerExchangeHandler in project californium by eclipse.
the class HttpServer method registerProxy.
/**
* Register proxy request handler.
*
* The proxy handler is used for all requests, which contains a
* {@code absoluteURI}, which is not related to one of the used virtual
* handlers.
*
* @param <T> request presentation
* @param requestHandler request handler to register
* @throws NullPointerException if request handler is {@code null}
* @throws IllegalStateException if server was already started
* @see #registerVirtual(String, String, AsyncServerRequestHandler)
* @see <a href="https://tools.ietf.org/html/rfc2616#section-5.1.2" target=
* "_blank"> RFC2616, HTTP/1.1 - 5.1.2 Request-URI</a>
* @since 3.0
*/
public <T> void registerProxy(final AsyncServerRequestHandler<T> requestHandler) {
if (server != null) {
throw new IllegalStateException("http server already started!");
}
Args.notNull(requestHandler, "Request handler");
proxyServerFilter = new TerminalAsyncServerFilter(new HandlerFactory<AsyncServerExchangeHandler>() {
@Override
public AsyncServerExchangeHandler create(HttpRequest request, HttpContext context) throws HttpException {
return new BasicServerExchangeHandler<>(requestHandler);
}
});
}
Aggregations