@Override public Response handle() throws Exception { // Handle the case where the client does not send any desired capabilities. sessionId = allSessions.newSession( desiredCapabilities != null ? desiredCapabilities : new DesiredCapabilities()); Map<String, Object> capabilities = Maps.newHashMap(allSessions.get(sessionId).getCapabilities().asMap()); // Only servers implementing the server-side webdriver-backed selenium need // to return this particular value capabilities.put("webdriver.remote.sessionid", sessionId.toString()); if (desiredCapabilities != null) { LoggingManager.perSessionLogHandler() .configureLogging( (LoggingPreferences) desiredCapabilities.getCapability(CapabilityType.LOGGING_PREFS)); } LoggingManager.perSessionLogHandler().attachToCurrentThread(sessionId); Response response = new Response(); response.setSessionId(sessionId.toString()); response.setValue(capabilities); return response; }