private RequestHandler lookupHandler(String uri, String methodName) { // We don't normalize the URI here because it is normalized when // the HTTP request comes in. if (log.logDebug()) { log.debug("Look up handler for URI [" + uri + "] and method [" + methodName + "]"); } RequestHandler handler = null; Map patternMap = (Map) this.uriHandlers.get(uri); if (patternMap == null) { if (log.logDebug()) { log.debug("Nothing registered for uri [" + uri + "]"); } return null; } Iterator patterns = patternMap.entrySet().iterator(); while (patterns.hasNext()) { Map.Entry entry = (Map.Entry) patterns.next(); Pattern pattern = (Pattern) this.globalPatternMap.get(entry.getKey()); if (pattern.matcher(methodName).find()) { if (log.logDebug()) { log.debug("Handler matched on pattern [" + pattern + "]"); } handler = (RequestHandler) entry.getValue(); } } return handler; }
// TODO: Document protected Encoding selectResponseEncoding(HttpRequestBuffer request) { Map accepted = request.getAcceptedEncodings(); if (accepted == null) { return null; } Iterator encodings = accepted.keySet().iterator(); while (encodings.hasNext()) { String encodingName = (String) encodings.next(); Encoding encoding = this.contentEncodingMap.getEncoding(encodingName); if (encoding != null) { return encoding; } } return null; }