1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

45 lines
1.3 KiB
Java

package com.owncloud.android.lib.common.http.webdav;
import java.io.IOException;
import java.util.Set;
import at.bitfire.dav4android.DavResource;
import at.bitfire.dav4android.PropertyUtils;
import at.bitfire.dav4android.exception.DavException;
import at.bitfire.dav4android.exception.HttpException;
import at.bitfire.dav4android.exception.UnauthorizedException;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Response;
public class PropfindMethod extends DavMethod {
private int mDepth;
private Set<DavResource> mMembers;
public PropfindMethod(OkHttpClient okHttpClient, HttpUrl httpUrl, int depth) {
super(okHttpClient, httpUrl);
mDepth = depth;
};
@Override
public Response execute() throws IOException, HttpException, DavException {
try {
mDavResource.propfind(mDepth, PropertyUtils.INSTANCE.getAllPropSet());
mMembers = mDavResource.getMembers();
} catch (UnauthorizedException davException) {
// Do nothing, we will use the 401 code to handle the situation
}
mRequest = mDavResource.getRequest();
return mDavResource.getResponse();
}
public int getDepth() {
return mDepth;
}
public Set<DavResource> getMembers() {
return mMembers;
}
}