List of usage examples for org.apache.commons.httpclient HttpURL equals
public boolean equals(Object obj)
From source file:org.apache.webdav.ant.CollectionScanner.java
protected void readCollection(HttpURL collURL) throws URIException { if (!collURL.getPath().endsWith(SEPARATOR)) { collURL = Utils.createHttpURL(collURL, ""); collURL.setPath(collURL.getPath() + SEPARATOR); }/*from w w w . java 2 s . c o m*/ // get a list of all resources from the given URL PropFindMethod propFind = new PropFindMethod(collURL.getEscapedURI(), DepthSupport.DEPTH_1, PropFindMethod.BY_NAME); propFind.setPropertyNames(propertyNames.elements()); propFind.setFollowRedirects(true); propFind.setAssertHrefsArePathes(true); propFind.setDecodeResponseHrefs("UTF-8"); try { this.client.executeMethod(propFind); } catch (IOException e) { throw Utils.makeBuildException("Can't read collection content!", e); } List subCollections = new ArrayList(); this.properties.storeProperties(propFind); // this collection addResource(collURL.getPath(), true); // for each content element, check resource type and classify for (Enumeration e = propFind.getAllResponseURLs(); e.hasMoreElements();) { String href = (String) e.nextElement(); ResourceTypeProperty property = this.properties.getResourceType(collURL, href); if (property != null) { if (property.isCollection()) { if (!href.endsWith(SEPARATOR)) href = href + SEPARATOR; // the collection URL itself may be in the list of // response URL; filter them out to avoid recursion HttpURL sub = Utils.createHttpURL(collURL, href); if (!sub.equals(collURL)) { subCollections.add(Utils.createHttpURL(collURL, href)); } } else { addResource(href, false); } } else { throw new BuildException("Can't determine resourcetype."); } } // read all sub collections for (Iterator i = subCollections.iterator(); i.hasNext();) { readCollection((HttpURL) i.next()); } }