protected HttpClient httpClient() { return new HttpClient(); }
public Response post(String url, HttpParameters parameters) throws IOException { return request(buildPostMethod(url, parameters)); }
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 Response get(String url) throws IOException { return request(new GetMethod(url)); }
public Response forward(HttpParameters parameters) throws IOException { return httpClient.post(remoteControlDriverURL(), parameters); }
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 Response get(String url) throws IOException { return request(new GetMethod(url)); }
public Response forward(HttpParameters parameters) throws IOException { return httpClient.post(remoteControlDriverURL(), parameters); }
public Response post(String url, HttpParameters parameters) throws IOException { return request(buildPostMethod(url, parameters)); }
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; }
protected HttpClient httpClient() { return new HttpClient(); }
public Response get(String url) throws IOException { return request(new GetMethod(url)); }
public Response post(String url, HttpParameters parameters) throws IOException { return request(buildPostMethod(url, parameters)); }
response = httpClient.get(remoteControlPingURL()); } catch (Exception e) { LOGGER.warn("Remote Control at " + host + ":" + port + " is unresponsive");
public static RemoteControlProxy parse(HttpServletRequest request) { final RemoteControlProxy remoteControl; final String portParameter; final String environment; final String host; final int port; host = request.getParameter("host"); if (null == host || "".equals(host.trim())) { throw new IllegalStateException("You must specify a 'host' parameter"); } portParameter = request.getParameter("port"); if (null == portParameter || "".equals(portParameter.trim())) { throw new IllegalStateException("You must specify a 'port' parameter"); } port = Integer.parseInt(portParameter); environment = request.getParameter("environment"); if (null == environment || "".equals(environment.trim())) { throw new IllegalStateException("You must specify an 'environment' parameter"); } remoteControl = new RemoteControlProxy(host, port, environment, new HttpClient()); return remoteControl; }
public static RemoteControlProxy parse(HttpServletRequest request) { final RemoteControlProxy remoteControl; final String portParameter; final String environment; final String host; final int port; host = request.getParameter("host"); if (null == host || "".equals(host.trim())) { throw new IllegalStateException("You must specify a 'host' parameter"); } portParameter = request.getParameter("port"); if (null == portParameter || "".equals(portParameter.trim())) { throw new IllegalStateException("You must specify a 'port' parameter"); } port = Integer.parseInt(portParameter); environment = request.getParameter("environment"); if (null == environment || "".equals(environment.trim())) { throw new IllegalStateException("You must specify an 'environment' parameter"); } remoteControl = new RemoteControlProxy(host, port, environment, new HttpClient()); return remoteControl; }