protected MapEntry<K, V> findEntry(K key) { SimpleList<MapEntry<K, V>> bucket = entries.get(key.hashCode()); return findEntry(key, bucket); }
public void put(long key, T value) { get(key).add(value); }
public Handler findHandler(Buf buf, Range action, Range path) { long hash = hash(buf.bytes(), action, path); SimpleList<Route> candidates = routes.get(hash); if (candidates != null) { for (int i = 0; i < candidates.size(); i++) { Route route = candidates.get(i); if (BytesUtil.matches(buf.bytes(), action, route.action, true) && BytesUtil.startsWith(buf.bytes(), path, route.path, true)) { int pos = path.start + route.path.length; if (path.limit() == pos || buf.get(pos) == '/') { return route.handler; } } } } return null; }
private Handler findHandler(HttpExchangeImpl x) { Buf buf = x.input(); Range action = x.verb_().range(); Range path = x.path_().range(); // serveStaticFileIfExists(x, buf, path); long hash = hash(buf.bytes(), action, path); synchronized (this) { SimpleList<Route> candidates = routes.get(hash); candidates = routes.get(hash); if (candidates != null) { for (int i = 0; i < candidates.size(); i++) { Route route = candidates.get(i); if (BytesUtil.matches(buf.bytes(), action, route.action, true) && BytesUtil.startsWith(buf.bytes(), path, route.path, true)) { int pos = path.start + route.path.length; if (path.limit() == pos || buf.get(pos) == '/') { x.setSubpath(pos, path.limit()); return route.handler; } } } } if (genericHandler != null) { x.setSubpath(path.start, path.limit()); return genericHandler; } } throw x.notFound(); }