List of usage examples for org.apache.commons.httpclient.methods HeadMethod addRequestHeader
@Override public void addRequestHeader(Header header)
From source file:com.xmlcalabash.library.ApacheHttpRequest.java
private HeadMethod doHead() { HeadMethod method = new HeadMethod(requestURI.toASCIIString()); // Provide custom retry handler is necessary method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); for (Header header : headers) { method.addRequestHeader(header); }// w w w.j a v a 2 s.c o m return method; }
From source file:org.apache.hadoop.fs.swift.http.SwiftRestClient.java
/** * Returns object length//from ww w. java2s. c o m * * @param uri file URI * @return object length * @throws SwiftException on swift-related issues * @throws IOException on network/IO problems */ public long getContentLength(URI uri) throws IOException { preRemoteCommand("getContentLength"); return perform(uri, new HeadMethodProcessor<Long>() { @Override public Long extractResult(HeadMethod method) throws IOException { return method.getResponseContentLength(); } @Override protected void setup(HeadMethod method) throws IOException { super.setup(method); method.addRequestHeader(NEWEST); } }); }