/** * Print this HttpException and its stack trace to the standard error stream. * * @since 3.0 */ public void printStackTrace() { printStackTrace(System.err); }
e.printStackTrace(); } catch (IOException e) {
/** * Print this HttpException and its stack trace to the standard error stream. * * @since 3.0 */ public void printStackTrace() { printStackTrace(System.err); }
/** * Print this HttpException and its stack trace to the standard error stream. * * @since 3.0 */ public void printStackTrace() { printStackTrace(System.err); }
/** * Print this HttpException and its stack trace to the standard error stream. * * @since 3.0 */ public void printStackTrace() { printStackTrace(System.err); }
/** * Print this HttpException and its stack trace to the standard error stream. * * @since 3.0 */ public void printStackTrace() { printStackTrace(System.err); }
private String doCall(String uri) throws IOException { System.out.println("We're calling the uri"); HttpClient httpClient = new HttpClient(); httpClient.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); HttpMethod getMethod = new GetMethod(uri); try { int response = httpClient.executeMethod(getMethod); if (response != 200) { throw new IOException("HTTP problem, httpcode: " + response); } InputStream stream = getMethod.getResponseBodyAsStream(); String responseText = responseToString(stream); return responseText; } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
private String doCall(String uri) throws IOException { System.out.println("We're calling the uri"); HttpClient httpClient = new HttpClient(); httpClient.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); HttpMethod getMethod = new GetMethod(uri); try { int response = httpClient.executeMethod(getMethod); if (response != 200) { throw new IOException("HTTP problem, httpcode: " + response); } InputStream stream = getMethod.getResponseBodyAsStream(); String responseText = responseToString(stream); return responseText; } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
/** * http-GET for rest interface to couchDB * @author daemonmidi@gmail.com * @since version 2.6 * @param url * @return String responseBody */ private String sendGet(String url){ String responseBody = ""; org.apache.commons.httpclient.HttpClient client = new HttpClient(); client.getParams().setParameter("http.useragent", "jbrofuzz"); GetMethod method = new GetMethod(url); try { // int returnCode = client.executeMethod(method); responseBody = method.getResponseBodyAsString(); } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally{ client.getHttpConnectionManager().closeIdleConnections(0); } return responseBody; }
e.printStackTrace(); } catch (IOException e) { System.err.println("Fatal transport error: " + e.getMessage());
e.printStackTrace(); } catch (IOException e) { System.err.println("Fatal transport error: " + e.getMessage());
/** * http delete for rest interface to couchdb * @author daemonmidi@gmail.com * @since version 2.5 * @param url * @return string repsonsebody * @throws InstantiationException * @throws IllegalAccessException */ private String sendDelete(String url){ String responseBody = ""; DeleteMethod method = new DeleteMethod(url); org.apache.commons.httpclient.HttpClient client = new HttpClient(); client.getParams().setParameter("http.useragent", "jbrofuzz"); try { client.executeMethod(method); responseBody = method.getResponseBodyAsString(); } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally{ client.getHttpConnectionManager().closeIdleConnections(0); } return responseBody; }
/** * put-method for rest interface to couchdb * @author daemonmidi@gmail.com * @since version 2.5 * @param url * @return string responesBody */ private String sendPut(String url, String requestBody){ String responseBody = ""; org.apache.commons.httpclient.HttpClient client = new HttpClient(); client.getParams().setParameter("http.useragent", "jbrofuzz"); PutMethod method = new PutMethod(url); // method.getParams().setParameter("retryHandler", new DefaultHttpRequestRetryHandler(3, false)); if (requestBody.length() > 0 ) method.setRequestBody(requestBody); try { responseBody = method.getResponseBodyAsString(); } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally{ client.getHttpConnectionManager().closeIdleConnections(0); } return responseBody; }
@RequestMapping("consume_sms") public Map<String, String> consumeSMS(String orderId, String txnAmt, String token) { try { return consumeSMS.request(orderId, txnAmt, token); } catch (SignValidateFailException e) { e.printStackTrace(); } catch (HttpException e) { e.printStackTrace(); } return null; }
@RequestMapping("open_query") public Map<String, String> openQuery(String orderId, HttpServletRequest request) { try { return openQuery.query(orderId, null); } catch (SignValidateFailException e) { e.printStackTrace(); } catch (HttpException e) { e.printStackTrace(); } return null; }
@RequestMapping("consume") public Map<String, String> consume(String orderId, String txnAmt, String token, String smsCode, String reqReserved) { try { return consume.consume(orderId, txnAmt, token, smsCode, reqReserved); } catch (HttpException e) { e.printStackTrace(); } catch (SignValidateFailException e) { e.printStackTrace(); } return null; }
@RequestMapping("delete_token") public Map<String, String> deleteToken(String orderId, String token) { try { return deleteToken.delete(orderId, token); } catch (HttpException e) { e.printStackTrace(); } catch (SignValidateFailException e) { e.printStackTrace(); } return null; }
@RequestMapping("consume_status_query") public Map<String, String> consumeStatusQuery(String orderId, String txnTime) { try { return consumeStatusQuery.query(orderId, txnTime); } catch (SignValidateFailException e) { e.printStackTrace(); } catch (HttpException e) { e.printStackTrace(); } return null; }
public RobotRules getRulesForUrl(String url, String userAgent) throws IOException, RobotsUnavailableException { String robotsUrl = robotsUrlForUrl(url); HttpMethod method = new GetMethod(robotsUrl); method.addRequestHeader("User-Agent", userAgent); try { int code = http.executeMethod(method); // TODO: Constant 200 if (code != 200) { throw new RobotsUnavailableException(robotsUrl); } } catch (HttpException e) { e.printStackTrace(); throw new RobotsUnavailableException(robotsUrl); } catch (UnknownHostException e) { LOGGER.info("Unknown host for URL " + robotsUrl); throw new RobotsUnavailableException(robotsUrl); } catch (ConnectTimeoutException e) { LOGGER.info("Connection Timeout for URL " + robotsUrl); throw new RobotsUnavailableException(robotsUrl); } catch (NoRouteToHostException e) { LOGGER.info("No route to host for URL " + robotsUrl); throw new RobotsUnavailableException(robotsUrl); } catch (ConnectException e) { LOGGER.info("ConnectException URL " + robotsUrl); throw new RobotsUnavailableException(robotsUrl); } RobotRules rules = new RobotRules(); rules.parse(method.getResponseBodyAsStream()); return rules; }
public RobotRules getRulesForUrl(String url, String userAgent) throws IOException, RobotsUnavailableException { String robotsUrl = robotsUrlForUrl(url); HttpMethod method = new GetMethod(robotsUrl); method.addRequestHeader("User-Agent", userAgent); try { int code = http.executeMethod(method); // TODO: Constant 200 if (code != 200) { throw new RobotsUnavailableException(robotsUrl); } } catch (HttpException e) { e.printStackTrace(); throw new RobotsUnavailableException(robotsUrl); } catch (UnknownHostException e) { LOGGER.info("Unknown host for URL " + robotsUrl); throw new RobotsUnavailableException(robotsUrl); } catch (ConnectTimeoutException e) { LOGGER.info("Connection Timeout for URL " + robotsUrl); throw new RobotsUnavailableException(robotsUrl); } catch (NoRouteToHostException e) { LOGGER.info("No route to host for URL " + robotsUrl); throw new RobotsUnavailableException(robotsUrl); } catch (ConnectException e) { LOGGER.info("ConnectException URL " + robotsUrl); throw new RobotsUnavailableException(robotsUrl); } RobotRules rules = new RobotRules(); rules.parse(method.getResponseBodyAsStream()); return rules; }