/** * Contact the remote WebDAV server and do a PROPFIND lookup, returning a {@link List} of all * scavenged resources. */ private List propfind(Location location) throws IOException { /* Create the new HttpClient instance associated with the location */ final HttpClient client = new HttpClient(location); client.addRequestHeader("Depth", "1"); client.setAcceptableStatus(207).connect("PROPFIND", true); /* Get the XML SAX Parser and parse the output of the PROPFIND */ try { final SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(false); factory.setNamespaceAware(true); final SAXParser parser = factory.newSAXParser(); final String systemId = location.toString(); final InputSource source = new InputSource(systemId); final Handler handler = new Handler(location); source.setByteStream(client.getResponseStream()); parser.parse(source, handler); return handler.list; } catch (ParserConfigurationException exception) { Exception throwable = new IOException("Error creating XML parser"); throw (IOException) throwable.initCause(exception); } catch (SAXException exception) { Exception throwable = new IOException("Error creating XML parser"); throw (IOException) throwable.initCause(exception); } finally { client.disconnect(); } }