@Override public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { org.apache.logging.log4j.ThreadContext.clearAll(); if(!checkAndAuthenticateRequest(request, channel, client)) { original.handleRequest(request, channel, client); } } };
/** * {@inheritDoc} * <p> * Usage is logged via the {@link DeprecationLogger} so that the actual response can be notified of deprecation as well. */ @Override public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { deprecationLogger.deprecated(deprecationMessage); handler.handleRequest(request, channel, client); }
wrappedHandler.handleRequest(request, responseChannel, client); requestHandled = true; } catch (Exception e) {
/** * {@inheritDoc} * <p> * Usage is logged via the {@link DeprecationLogger} so that the actual response can be notified of deprecation as well. */ @Override public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { deprecationLogger.deprecated(deprecationMessage); handler.handleRequest(request, channel, client); }
/** * {@inheritDoc} * <p> * Usage is logged via the {@link DeprecationLogger} so that the actual response can be notified of deprecation as well. */ @Override public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { deprecationLogger.deprecated(deprecationMessage); handler.handleRequest(request, channel, client); }
@Override public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { org.apache.logging.log4j.ThreadContext.clearAll(); if(!checkAndAuthenticateRequest(request, channel, client)) { original.handleRequest(request, channel, client); } } };
/** * {@inheritDoc} * <p> * Usage is logged via the {@link DeprecationLogger} so that the actual response can be notified of deprecation as well. */ @Override public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { deprecationLogger.deprecated(deprecationMessage); handler.handleRequest(request, channel, client); }
public void dispatchRequest(final RestRequest request, final RestChannel channel) { try { if (request instanceof NettyHttpRequest) { NettyHttpRequest nettyHttpRequest = (NettyHttpRequest)request; if ("PATCH".equalsIgnoreCase(nettyHttpRequest.getMethod())) { RestHandler handler = patchHandlers.retrieve(request.rawPath()); if (handler != null) { handler.handleRequest(request, channel); } } } } catch (Throwable e) { try { channel.sendResponse(new BytesRestResponse(channel, e)); } catch (Throwable e1) { logger.error("failed to send failure response for uri [" + request.uri() + "]", e1); } } } }
@Override public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception { if (bucklerConfig.getAuthConfig().isEnabledForHttp() && !allow(request, bucklerConfig.getAuthConfig())) { BytesRestResponse response = new BytesRestResponse(channel, RestStatus.UNAUTHORIZED, null); response.addHeader(HttpHeaderNames.WWW_AUTHENTICATE.toString(), "Basic realm=\"Restricted\""); channel.sendResponse(response); return; } restHandler.handleRequest(request, channel, client); }
void executeHandler(RestRequest request, RestChannel channel) throws Exception { final RestHandler handler = getHandler(request); if (handler != null) { handler.handleRequest(request, channel); } else { if (request.method() == RestRequest.Method.OPTIONS) { // when we have OPTIONS request, simply send OK by default (with the Access Control Origin header which gets automatically added) channel.sendResponse(new BytesRestResponse(OK)); } else { channel.sendResponse(new BytesRestResponse(BAD_REQUEST, "No handler found for uri [" + request.uri() + "] and method [" + request.method() + "]")); } } }
wrappedHandler.handleRequest(request, responseChannel, client); requestHandled = true; } catch (Exception e) {
void dispatchRequest(final RestRequest request, final RestChannel channel, final NodeClient client, ThreadContext threadContext, final RestHandler handler) throws Exception { if (checkRequestParameters(request, channel) == false) { channel .sendResponse(BytesRestResponse.createSimpleErrorResponse(channel,BAD_REQUEST, "error traces in responses are disabled.")); } else { for (String key : headersToCopy) { String httpHeader = request.header(key); if (httpHeader != null) { threadContext.putHeader(key, httpHeader); } } if (handler == null) { if (request.method() == RestRequest.Method.OPTIONS) { // when we have OPTIONS request, simply send OK by default (with the Access Control Origin header which gets automatically added) channel.sendResponse(new BytesRestResponse(OK, BytesRestResponse.TEXT_CONTENT_TYPE, BytesArray.EMPTY)); } else { final String msg = "No handler found for uri [" + request.uri() + "] and method [" + request.method() + "]"; channel.sendResponse(new BytesRestResponse(BAD_REQUEST, msg)); } } else { final RestHandler wrappedHandler = Objects.requireNonNull(handlerWrapper.apply(handler)); wrappedHandler.handleRequest(request, channel, client); } } }
wrappedHandler.handleRequest(request, responseChannel, client); requestHandled = true; } catch (Exception e) {