public ArrayValue getChildren(URI uri, Credentials credentials) throws IOException {
String url = domain+uri.toString();
if ( url.charAt(url.length()-1) == '/') {
url = url.substring(0, url.length()-1);
}
PropFindMethod propfindMethod = new PropFindMethod(url, 0);
propfindMethod.setDepth(1);
propfindMethod.setDoAuthentication(true);
HttpState httpState = new HttpState();
httpState.setCredentials(null, host, credentials);
int state = propfindMethod.execute(httpState, new HttpConnection(host, port, protocol));
if ( state != HttpStatus.SC_MULTI_STATUS ) {
throw new IOException("Received status code "+state+" when doing PROPFIND on URI="+url);
}
List children = new ArrayList();
for ( Enumeration propertyEnumeration = propfindMethod.getAllResponseURLs(); propertyEnumeration.hasMoreElements(); ) {
String childUrl = (String)propertyEnumeration.nextElement();
if ( !childUrl.equals(url) ) {
if ( childUrl.indexOf(domain) != -1 ) {
childUrl = childUrl.substring(childUrl.indexOf(domain)+domain.length());
}