this.requestEntity = new InputStreamRequestEntity( requestStream, requestContentLength);
eeMethod.setRequestEntity(new InputStreamRequestEntity(content, contentType));
@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); }
@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); }
os.close(); } else { requestEntity = new InputStreamRequestEntity( entity.getContent(), entity.getContentType().toString());
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); }
private File prepareProxiedMethodBody(EntityEnclosingMethod method, HttpServletRequest request) throws ServletException, IOException { File requestBodyFile = getRequestBodyAsFile(request); method.setRequestEntity( new InputStreamRequestEntity( new BufferedInputStream(new FileInputStream(requestBodyFile)), requestBodyFile.length(), request.getContentType() ) ); return requestBodyFile; }
protected PutMethod executePut(String uri, InputStream content, String mediaType, int... expectedCodes) throws Exception { PutMethod putMethod = new PutMethod(uri); RequestEntity entity = new InputStreamRequestEntity(content, mediaType); putMethod.setRequestEntity(entity); int code = this.adminHTTPClient.executeMethod(putMethod); if (!ArrayUtils.contains(expectedCodes, code)) { throw new Exception("Failed to execute put [" + uri + "] with code [" + code + "]"); } return putMethod; } }
/** Upload a file to the Sling repository * @return the HTTP status code */ public int upload(String toUrl, InputStream is) throws IOException { final PutMethod put = new PutMethod(toUrl); put.setRequestEntity(new InputStreamRequestEntity(is)); return httpClient.executeMethod(put); }
/** * @since 7.3M1 */ protected PutMethod executePut(String uri, InputStream content, String mediaType) throws Exception { PutMethod putMethod = new PutMethod(uri); RequestEntity entity = new InputStreamRequestEntity(content, mediaType); putMethod.setRequestEntity(entity); this.httpClient.executeMethod(putMethod); return putMethod; }
public void upload(InputStream contents, String baseURI, RDFFormat dataFormat, boolean overwrite, long size, String contentEncoding, JSONObject attributes, Resource... contexts) throws RDFParseException, AGHttpException { String format = dataFormat.getDefaultMIMEType(); RequestEntity entity = new InputStreamRequestEntity(contents, size, format); upload(entity, baseURI, overwrite, null, null, null, attributes, contentEncoding, contexts); }
public String evalInServer(InputStream stream) throws AGHttpException { String url = AGProtocol.getEvalLocation(getRoot()); List<Header> headers = new ArrayList<>(); headers.add(new Header("Content-Type", "text/plain; charset=utf-8")); AGStringHandler handler = new AGStringHandler(); RequestEntity entity = new InputStreamRequestEntity(stream, -1, null); post(url, headers, null, entity, handler); return handler.getResult(); }
public void addRules(InputStream rulestream) throws AGHttpException { useDedicatedSession(isAutoCommit()); String url = AGProtocol.getFunctorLocation(getRoot()); RequestEntity entity = new InputStreamRequestEntity(rulestream, -1, null); post(url, null, null, entity, null); }