public void handleRequest(HttpRequest request, HttpResponse response) throws WebDriverException { try { UrlMapper mapper = getUrlMapper(request.getMethod()); if (mapper == null) { response.setStatus(INTERNAL_SERVER_ERROR); response.end(); return; } ResultConfig config = mapper.getConfig(request.getPath()); if (config == null) { response.setStatus(NOT_FOUND); response.end(); } else { config.handle(request.getPath(), request, response); } } catch (SessionNotFoundException e) { response.setStatus(NOT_FOUND); response.end(); } catch (Exception e) { log.warning("Fatal, unhandled exception: " + request.getPath() + ": " + e); throw new WebDriverException(e); } }