* @param request
* @param context
* @return HttpRequestHandler
*/
public HttpRequestHandler lookup(HttpRequest request, HttpContext context) {
HttpRequestHandlerResolver resolver = null;
if (useVirtualHost) {
String host = RequestUtils.getRequestHostURL(request, context);
if (host == null) {
host = DEFAULT_HOST;
}
resolver = hostHandler.get(host);
}
if (resolver == null) {
resolver = hostHandler.get(DEFAULT_HOST);
}
if (LOG.isTraceEnabled() && resolver != null) {
LOG.trace("handler: " + resolver.getClass().getName());
}
HttpRequestHandler handler = null;
if (resolver != null) {
handler = resolver.lookup(request.getRequestLine().getUri());
if (handler == null) {
handler = resolver.lookup("/");
}
}
return handler;
}