protected Response forward(HttpParameters parameters, DynamicRemoteControlPool pool, EnvironmentManager environmentManager) throws IOException { final SeleneseCommand command; final Response response; LOGGER.info("Processing '" + parameters.toString() + "'"); try { command = new HttpCommandParser(parameters).parse(environmentManager); response = command.execute(pool); } catch (CommandParsingException e) { LOGGER.error("Failed to parse '" + parameters.toString() + "' : " + e.getMessage()); return new Response(e.getMessage()); } catch (NoSuchEnvironmentException e) { LOGGER.error("Could not find any remote control providing the '" + e.environment() + "' environment. Please make sure you started some remote controls which registered as offering this environment."); return new Response(e.getMessage()); } LOGGER.info("Responding with " + response.statusCode() + "/ '" + response.body() + "'"); return response; }
protected Response forward(HttpParameters parameters, DynamicRemoteControlPool pool, EnvironmentManager environmentManager) throws IOException { final SeleneseCommand command; final Response response; LOGGER.info("Processing '" + parameters.toString() + "'"); try { command = new HttpCommandParser(parameters).parse(environmentManager); response = command.execute(pool); } catch (CommandParsingException e) { LOGGER.error("Failed to parse '" + parameters.toString() + "' : " + e.getMessage()); return new Response(e.getMessage()); } catch (NoSuchEnvironmentException e) { LOGGER.error("Could not find any remote control providing the '" + e.environment() + "' environment. Please make sure you started some remote controls which registered as offering this environment."); return new Response(e.getMessage()); } catch (NoSuchSessionException e) { LOGGER.error(e.getMessage()); return new Response(e.getMessage()); } final String responseBody = response.body(); if (responseBody.length() > 128) { final int truncated = responseBody.length() - 128; LOGGER.info(String.format("Responding with %d / %s...[%d characters truncated]", response.statusCode(), responseBody.substring(0, 128), truncated)); } else { LOGGER.info(String.format("Responding with %d / %s", response.statusCode(), responseBody)); } return response; }
public Response execute(RemoteControlPool pool) throws IOException { final RemoteControlProxy remoteControl; final Response response; if (null == sessionId) { return new Response("Selenium Driver error: No sessionId provided for command '" + parameters.toString() + "'"); } remoteControl = pool.retrieve(sessionId()); pool.updateSessionLastActiveAt(sessionId); response = remoteControl.forward(parameters()); pool.updateSessionLastActiveAt(sessionId); return response; }
public Response execute(RemoteControlPool pool) throws IOException { final RemoteControlProxy remoteControl; final Response response; if (null == sessionId) { return new Response("Selenium Driver error: No sessionId provided for command '" + parameters.toString() + "'"); } remoteControl = pool.retrieve(sessionId()); pool.updateSessionLastActiveAt(sessionId); response = remoteControl.forward(parameters()); pool.updateSessionLastActiveAt(sessionId); return response; }