protected void reply(HttpServletResponse response, Response remoteControlResponse) throws IOException { response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); response.setStatus(remoteControlResponse.statusCode()); response.getWriter().print(remoteControlResponse.body()); }
protected void reply(HttpServletResponse response, Response remoteControlResponse) throws IOException { response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); response.setStatus(remoteControlResponse.statusCode()); response.getWriter().print(remoteControlResponse.body()); }
public boolean unreliable() { final Response response; try { LOGGER.debug("Polling Remote Control at " + host + ":" + port); response = httpClient.get(remoteControlPingURL()); } catch (Exception e) { LOGGER.warn("Remote Control at " + host + ":" + port + " is unresponsive"); return true; } if (response.statusCode() != 200) { LOGGER.warn("Remote Control at " + host + ":" + port + " did not respond correctly"); return true; } return false; }
public Status execute() { final Response response; try { LOGGER.info("Ping Hub at " + heartBeatURL); response = httpClient().get(heartBeatURL); } catch (Exception e) { LOGGER.warn("Hub at " + heartBeatURL + " is unresponsive"); return Status.DOWN; } if (response.statusCode() != 200) { LOGGER.warn("Hub at " + heartBeatURL + " did not respond correctly"); return Status.DOWN; } if (!response.body().equals("Hub : OK")) { LOGGER.warn("Hub at " + heartBeatURL + " does not have us as registered"); return Status.UNREGISTERED; } return Status.OK; }
public Status execute() { final Response response; try { LOGGER.info("Ping Hub at " + heartBeatURL); response = httpClient().get(heartBeatURL); } catch (Exception e) { LOGGER.warn("Hub at " + heartBeatURL + " is unresponsive"); return Status.DOWN; } if (response.statusCode() != 200) { LOGGER.warn("Hub at " + heartBeatURL + " did not respond correctly"); return Status.DOWN; } if (!response.body().equals("Hub : OK")) { LOGGER.warn("Hub at " + heartBeatURL + " does not have us as registered"); return Status.UNREGISTERED; } return Status.OK; }
if (response.statusCode() != 200) { LOGGER.warn("Remote Control at " + host + ":" + port + " did not respond correctly");
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; }
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; }