.getProcessingState().getHttpContext();
Request handlerRequest = httpRequestInProgress.get(context);
if (handlerRequest == null) {
// It's a new HTTP request
final HttpRequestPacket request = (HttpRequestPacket) httpContent.getHttpHeader();
final HttpResponsePacket response = request.getResponse();
handlerRequest = Request.create();
handlerRequest.parameters.setLimit(config.getMaxRequestParameters());
httpRequestInProgress.set(context, handlerRequest);
final Response handlerResponse = handlerRequest.getResponse();
handlerRequest.initialize(request, ctx, this);
handlerResponse.initialize(handlerRequest, response,
ctx, suspendedResponseQueue, this);
if (config.isGracefulShutdownSupported()) {
activeRequestsCounter.incrementAndGet();
handlerRequest.addAfterServiceListener(flushResponseHandler);
}
HttpServerProbeNotifier.notifyRequestReceive(this, connection,
handlerRequest);
boolean wasSuspended = false;
try {
ctx.setMessage(handlerResponse);
if (isShuttingDown) { // if we're in the shutting down phase - serve shutdown page and exit
handlerResponse.getResponse().getProcessingState().setError(true);
HtmlHelper.setErrorAndSendErrorPage(
handlerRequest, handlerResponse,
config.getDefaultErrorPageGenerator(),
503, HttpStatus.SERVICE_UNAVAILABLE_503.getReasonPhrase(),
"The server is being shutting down...", null);
} else if (!config.isPassTraceRequest()
&& request.getMethod() == Method.TRACE) {
onTraceRequest(handlerRequest, handlerResponse);
} else if (!checkMaxPostSize(request.getContentLength())) {
handlerResponse.getResponse().getProcessingState().setError(true);
HtmlHelper.setErrorAndSendErrorPage(
handlerRequest, handlerResponse,
config.getDefaultErrorPageGenerator(),
400, HttpStatus.BAD_REQUEST_400.getReasonPhrase(),
"The request payload size exceeds the max post size limitation", null);
} else {
final HttpHandler httpHandlerLocal = httpHandler;
if (httpHandlerLocal != null) {
wasSuspended = !httpHandlerLocal.doHandle(
handlerRequest, handlerResponse);
}
}
} catch (Exception t) {
LOGGER.log(Level.WARNING,
LogMessages.WARNING_GRIZZLY_HTTP_SERVER_FILTER_HTTPHANDLER_INVOCATION_ERROR(), t);
request.getProcessingState().setError(true);
if (!response.isCommitted()) {
HtmlHelper.setErrorAndSendErrorPage(
handlerRequest, handlerResponse,
config.getDefaultErrorPageGenerator(),