use of org.apache.http.client.methods.HttpPatch in project azure-tools-for-java by Microsoft.
the class ADLSGen2FSOperation method appendData.
private Observable<Long> appendData(String filePath, File src) {
try {
InputStreamEntity reqEntity = new InputStreamEntity(new FileInputStream(src), -1, ContentType.APPLICATION_OCTET_STREAM);
BufferedHttpEntity entity = new BufferedHttpEntity(reqEntity);
long len = entity.getContentLength();
HttpPatch req = new HttpPatch(filePath);
http.setContentType("application/octet-stream");
return http.executeReqAndCheckStatus(req, entity, this.appendReqParams, Collections.emptyList(), 202).map(ignore -> len);
} catch (FileNotFoundException e) {
throw new RuntimeException(new IllegalArgumentException("Can not find the aritifact"));
} catch (IOException e) {
throw new RuntimeException(new IllegalArgumentException("Can not read the aritfact"));
}
}
use of org.apache.http.client.methods.HttpPatch in project azure-tools-for-java by Microsoft.
the class ADLSGen2FSOperation method flushData.
private Observable<Boolean> flushData(String filePath, long flushLen) {
HttpPatch req = new HttpPatch(filePath);
List<NameValuePair> flushReqParams = this.flushReqParamsBuilder.setPosition(flushLen).build();
http.setContentType("application/json");
return http.executeReqAndCheckStatus(req, null, flushReqParams, Collections.emptyList(), 200).map(ignore -> true);
}
use of org.apache.http.client.methods.HttpPatch in project knox by apache.
the class DefaultDispatch method doPatch.
@Override
public void doPatch(URI url, HttpServletRequest request, HttpServletResponse response) throws IOException {
HttpPatch method = new HttpPatch(url);
HttpEntity entity = createRequestEntity(request);
method.setEntity(entity);
copyRequestHeaderFields(method, request);
executeRequestWrapper(method, request, response);
}
Aggregations