private void respondToPreviousRequest() { Request previousRequest = (Request) pendingRequest.poll(); if (previousRequest != null) { try { previousRequest.respondWith(EmptyResponseHandler); } catch (Exception e) { e.printStackTrace(); } } }
public void service(Request request) throws Exception { String path = request.getURI().getPath(); ListIterator i = new ArrayList(matchers).listIterator(); while (i.hasNext()) { int index = i.nextIndex(); Pattern pattern = (Pattern) i.next(); if (pattern.matcher(path).find()) { Server server = (Server) servers.get(index); server.service(request); return; } } request.respondWith(new NotFoundHandler("Could not find resource at " + path)); }