public void internalDispatchRequest(final HttpRequest request, final HttpChannel channel) { if (request.rawPath().startsWith("/_plugin/")) { RestFilterChain filterChain = restController.filterChain(pluginSiteFilter); filterChain.continueProcessing(request, channel); return; } try { restController.dispatchRequest(request, channel); } catch (ElasticsearchIllegalArgumentException e) { // unsupported HTTP method, try HTTP PATCH httpPatchRestController.dispatchRequest(request, channel); } }
public void internalDispatchRequest(final RestRequest request, final RestChannel channel) { String rawPath = request.rawPath(); if (rawPath.startsWith("/_plugin/")) { RestFilterChain filterChain = restController.filterChain(pluginSiteFilter); filterChain.continueProcessing(request, channel); return; } else if (rawPath.equals("/favicon.ico")) { handleFavicon(request, channel); return; } RestChannel responseChannel = channel; try { int contentLength = request.content().length(); if (restController.canTripCircuitBreaker(request)) { inFlightRequestsBreaker(circuitBreakerService).addEstimateBytesAndMaybeBreak(contentLength, "<http_request>"); } else { inFlightRequestsBreaker(circuitBreakerService).addWithoutBreaking(contentLength); } // iff we could reserve bytes for the request we need to send the response also over this channel responseChannel = new ResourceHandlingHttpChannel(channel, circuitBreakerService); restController.dispatchRequest(request, responseChannel); } catch (Throwable t) { restController.sendErrorResponse(request, responseChannel, t); } }