List of usage examples for org.apache.commons.httpclient.methods HeadMethod getPath
@Override
public String getPath()
From source file:org.osaf.caldav4j.CalDAVCollection.java
/** * retrieve etags using HEAD /path/to/resource.ics * /*from w w w. j av a 2 s.com*/ * @param httpClient * @param path * @return * @throws CalDAV4JException */ protected String getETag(HttpClient httpClient, String path) throws CalDAV4JException { HeadMethod headMethod = new HeadMethod(path); try { httpClient.executeMethod(hostConfiguration, headMethod); int statusCode = headMethod.getStatusCode(); if (statusCode == CaldavStatus.SC_NOT_FOUND) { throw new ResourceNotFoundException(ResourceNotFoundException.IdentifierType.PATH, path); } if (statusCode != CaldavStatus.SC_OK) { throw new CalDAV4JException( "Unexpected Status returned from Server: " + headMethod.getStatusCode()); } } catch (IOException e) { String message = hostConfiguration.getHostURL() + headMethod.getPath(); throw new CalDAV4JException("Problem executing HEAD method on: " + message, e); } Header h = headMethod.getResponseHeader(HEADER_ETAG); String etag = null; if (h != null) { etag = h.getValue(); } return etag; }