try {
this.httpProcessor.process(request, context);
HttpRequestHandler handler = null;
if (handlerResolver != null) {
String requestURI = request.getRequestLine().getUri();
handler = handlerResolver.lookup(requestURI);
}
if (handler != null) {
if (handler instanceof AsyncHttpRequestHandler) {
((AsyncHttpRequestHandler)handler).handle(request, context, new AsyncResponseHandler() {
public void sendResponse(HttpResponse response) throws IOException, HttpException {
try {
AsyncBufferingHttpServiceHandler.this.sendResponse(conn, response);
} catch (HttpException ex) {
response = AsyncBufferingHttpServiceHandler.this.responseFactory.newHttpResponse(
HttpVersion.HTTP_1_0, HttpStatus.SC_INTERNAL_SERVER_ERROR, conn.getContext());
response.setParams(AsyncBufferingHttpServiceHandler.this.params);
AsyncBufferingHttpServiceHandler.this.handleException(ex, response);
AsyncBufferingHttpServiceHandler.this.sendResponse(conn, response);
}
}
});
} else { // just hanlder the request with sync request handler
HttpResponse response = this.responseFactory.newHttpResponse(
ver, HttpStatus.SC_OK, conn.getContext());
response.setParams(this.params);
context.setAttribute(ExecutionContext.HTTP_RESPONSE, response);
handler.handle(request, response, context);
sendResponse(conn, response);
}
} else {
// add the default handler here
HttpResponse response = this.responseFactory.newHttpResponse(