static Tuple2<String, ContentExchange> createRequestForSign(String sign, HttpClient client) throws Exception { ContentExchange exchange = new ContentExchange(true); exchange.setURL("http://new73s.herokuapp.com/qsos/" + sign + ".json"); client.send(exchange); return new Tuple2(sign, exchange); } static ObjectMapper createMapper() {
public Iterable<String> call(Iterator<String> input) { ArrayList<String> content = new ArrayList<String>(); ArrayList<ContentExchange> cea = new ArrayList<ContentExchange>(); HttpClient client = new HttpClient(); try { client.start(); while (input.hasNext()) { ContentExchange exchange = new ContentExchange(true); exchange.setURL("http://qrzcq.com/call/" + input.next()); client.send(exchange); cea.add(exchange); } for (ContentExchange exchange : cea) { exchange.waitForDone(); content.add(exchange.getResponseContent()); } } catch (Exception e) { } return content; }}); System.out.println(StringUtils.join(result.collect(), ","));
public OdlOnem2mHttpRequestPrimitive() { httpRequest = new ContentExchange(true); uriQueryString = ""; to = ""; }
public JettyContentExchange8() { this.ce = new ContentExchange(true); }
/** * HTTP notifications will be set out to subscribers interested in resources from the tree where they have have hung * onem2m subscription resources * @param url where do i send this onem2m notify message * @param payload contents of the notification */ @Override public void sendNotification(String url, String payload) { ContentExchange ex = new ContentExchange(); ex.setURL(url); ex.setRequestContentSource(new ByteArrayInputStream(payload.getBytes())); ex.setRequestContentType(Onem2m.ContentType.APP_VND_NTFY_JSON); Integer cl = payload != null ? payload.length() : 0; ex.setRequestHeader("Content-Length", cl.toString()); ex.setMethod("post"); LOG.debug("HTTP: Send notification uri: {}, payload: {}:", url, payload); try { client.send(ex); } catch (IOException e) { LOG.error("Dropping notification: uri: {}, payload: {}", url, payload); } }
ContentExchange exchange = new ContentExchange(); exchange.setMethod("POST"); exchange.setURL(url);
ContentExchange ex = new ContentExchange(true);