this.requestEntity = new InputStreamRequestEntity( requestStream, requestContentLength);
/** * Gets the content length. If the content length has not been set, the content will be * buffered to determine the actual content length. */ public long getContentLength() { if (contentLength == CONTENT_LENGTH_AUTO && buffer == null) { bufferContent(); } return contentLength; }
post.setRequestHeader("Content-Length", String.valueOf(request.getStringData().getBytes(bodyCharset).length)); } else if (request.getStreamData() != null) { InputStreamRequestEntity r = new InputStreamRequestEntity(request.getStreamData()); post.setRequestEntity(r); post.setRequestHeader("Content-Length", String.valueOf(r.getContentLength())); InputStreamRequestEntity r = new InputStreamRequestEntity(fis); post.setRequestEntity(r); post.setRequestHeader("Content-Length", String.valueOf(r.getContentLength())); } finally { fis.close();
eeMethod.setRequestEntity(new InputStreamRequestEntity(content, contentType));
/** * Gets the content length. If the content length has not been set, the content will be * buffered to determine the actual content length. */ public long getContentLength() { if (contentLength == CONTENT_LENGTH_AUTO && buffer == null) { bufferContent(); } return contentLength; }
@Override public HTTPResponse post( final URL url, final InputStream postContent, final String postContentType) throws IOException { PostMethod postMethod = new PostMethod(url.toExternalForm()); postMethod.setDoAuthentication(user != null && password != null); if (postContentType != null) { postMethod.setRequestHeader("Content-type", postContentType); } RequestEntity requestEntity = new InputStreamRequestEntity(postContent); postMethod.setRequestEntity(requestEntity); int responseCode = client.executeMethod(postMethod); if (200 != responseCode) { postMethod.releaseConnection(); throw new IOException( "Server returned HTTP error code " + responseCode + " for URL " + url.toExternalForm()); } return new HttpMethodResponse(postMethod); }
/** * Gets the content length. If the content length has not been set, the content will be * buffered to determine the actual content length. */ public long getContentLength() { if (contentLength == CONTENT_LENGTH_AUTO && buffer == null) { bufferContent(); } return contentLength; }
@Override public HTTPResponse post( final URL url, final InputStream postContent, final String postContentType) throws IOException { PostMethod postMethod = new PostMethod(url.toExternalForm()); postMethod.setDoAuthentication(user != null && password != null); if (tryGzip) { postMethod.setRequestHeader("Accept-Encoding", "gzip"); } if (postContentType != null) { postMethod.setRequestHeader("Content-type", postContentType); } RequestEntity requestEntity = new InputStreamRequestEntity(postContent); postMethod.setRequestEntity(requestEntity); int responseCode = executeMethod(postMethod); if (200 != responseCode) { postMethod.releaseConnection(); throw new IOException( "Server returned HTTP error code " + responseCode + " for URL " + url.toExternalForm()); } return new HttpMethodResponse(postMethod); }
/** * Gets the content length. If the content length has not been set, the content will be * buffered to determine the actual content length. */ public long getContentLength() { if (contentLength == CONTENT_LENGTH_AUTO && buffer == null) { bufferContent(); } return contentLength; }
os.close(); } else { requestEntity = new InputStreamRequestEntity( entity.getContent(), entity.getContentType().toString());
/** * Gets the content length. If the content length has not been set, the content will be * buffered to determine the actual content length. */ public long getContentLength() { if (contentLength == CONTENT_LENGTH_AUTO && buffer == null) { bufferContent(); } return contentLength; }
public void setRequestBody(InputStream body) { requestBody = new InputStreamRequestEntity(body); } public void setRequestBody(RequestEntity body)
public void setRequestBody(InputStream body) { requestBody = new InputStreamRequestEntity(body); } public void setRequestBody(RequestEntity body)
/** * Sends an HTTP POST request to the specified URI. * * @param uri The request URI * @param in An InputStream providing the payload of the request * @param options The request options */ public ClientResponse post(String uri, InputStream in, RequestOptions options) { return execute("POST", uri, new InputStreamRequestEntity(in), options); }
/** * Sends an HTTP PUT request to the specified URI. * * @param uri The request URI * @param in An InputStream providing the payload of the request * @param options The request options */ public ClientResponse put(String uri, InputStream in, RequestOptions options) { return execute("PUT", uri, new InputStreamRequestEntity(in), options); }
/** * @since 7.3M1 */ protected PostMethod executePost(String uri, InputStream content, String mediaType) throws Exception { PostMethod postMethod = new PostMethod(uri); RequestEntity entity = new InputStreamRequestEntity(content, mediaType); postMethod.setRequestEntity(entity); this.httpClient.executeMethod(postMethod); return postMethod; }
public void sendRDFTransaction(InputStream rdftransaction, JSONObject attributes) throws AGHttpException { RequestEntity entity = new InputStreamRequestEntity(rdftransaction, -1, "application/x-rdftransaction"); upload(entity, null, false, null, null, null, attributes); }
@Override protected void setup(PutMethod method) throws SwiftInternalStateException { method.setRequestEntity(new InputStreamRequestEntity(data, length)); setHeaders(method, requestHeaders); } });
public void sendRDFTransaction(InputStream rdftransaction) throws AGHttpException { RequestEntity entity = new InputStreamRequestEntity(rdftransaction, -1, "application/x-rdftransaction"); upload(entity, null, false, null, null, null, null); }
/** * POSTs a Stream content to the given URL. * * @param url The URL where to connect to. * @param content The content to be sent as an InputStream. * @param contentType The content-type to advert in the POST. * @return The HTTP response as a String if the HTTP response code was 200 (OK). * @throws MalformedURLException * @return the HTTP response or <TT>null</TT> on errors. */ public String post(String url, InputStream content, String contentType) { return post(url, new InputStreamRequestEntity(content, contentType)); }