public void setRequestContent(InputStream ins) { ce.setRequestContentSource(ins); }
public synchronized void setFileForUpload(File fileForUpload) throws IOException { this._fileForUpload = fileForUpload; setRequestContentSource(getInputStream()); } }
public OdlOnem2mHttpRequestPrimitiveBuilder setContent(String value) { onem2mRequest.httpRequest.setRequestContentSource(new ByteArrayInputStream(value.getBytes())); onem2mRequest.httpRequest.setRequestContentType("application/json"); return this; }
@Override protected synchronized void onRetry() throws IOException { if (_fileForUpload != null) { setRequestContent(null); setRequestContentSource(getInputStream()); } else super.onRetry(); }
/** * 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); } }
exchange.setRequestContentSource(new ByteArrayInputStream(message .getBytes("UTF-8")));
ex.setRequestContentSource(new ByteArrayInputStream( request.getPrimitive(RequestPrimitive.CONTENT).getBytes())); ex.setRequestContentType(createRequestContentTypeString(request));