use of org.apache.jackrabbit.webdav.client.methods.HttpPropfind in project jackrabbit by apache.
the class BindTest method getParentSet.
private DavProperty getParentSet(String uri) throws IOException, DavException, URISyntaxException {
DavPropertyNameSet names = new DavPropertyNameSet();
names.add(BindConstants.PARENTSET);
HttpPropfind propfind = new HttpPropfind(uri, names, 0);
HttpResponse response = this.client.execute(propfind, this.context);
int status = response.getStatusLine().getStatusCode();
assertEquals(207, status);
MultiStatus multistatus = propfind.getResponseBodyAsMultiStatus(response);
MultiStatusResponse[] responses = multistatus.getResponses();
assertEquals(1, responses.length);
DavProperty parentset = responses[0].getProperties(200).get(BindConstants.PARENTSET);
assertNotNull(parentset);
return parentset;
}
use of org.apache.jackrabbit.webdav.client.methods.HttpPropfind in project jackrabbit by apache.
the class BindTest method getResourceId.
// utility methods
// see http://greenbytes.de/tech/webdav/rfc5842.html#rfc.section.3.1
private URI getResourceId(String uri) throws IOException, DavException, URISyntaxException {
DavPropertyNameSet names = new DavPropertyNameSet();
names.add(BindConstants.RESOURCEID);
HttpPropfind propfind = new HttpPropfind(uri, names, 0);
HttpResponse response = this.client.execute(propfind, this.context);
int status = response.getStatusLine().getStatusCode();
assertEquals(207, status);
MultiStatus multistatus = propfind.getResponseBodyAsMultiStatus(response);
MultiStatusResponse[] responses = multistatus.getResponses();
assertEquals(1, responses.length);
DavProperty resourceId = responses[0].getProperties(200).get(BindConstants.RESOURCEID);
assertNotNull(resourceId);
assertTrue(resourceId.getValue() instanceof Element);
Element href = (Element) resourceId.getValue();
assertEquals("href", href.getLocalName());
String text = getUri(href);
URI resid = new URI(text);
return resid;
}
use of org.apache.jackrabbit.webdav.client.methods.HttpPropfind in project jackrabbit by apache.
the class DavPropertyTest method doPropFindAll.
private DavPropertyNameSet doPropFindAll(String uri) throws Exception {
HttpPropfind request = new HttpPropfind(uri, DavConstants.PROPFIND_ALL_PROP, DavConstants.DEPTH_0);
HttpClient cl = rs.getClient(si);
HttpResponse response = cl.execute(request, rs.getContext(si));
request.checkSuccess(response);
MultiStatus ms = request.getResponseBodyAsMultiStatus(response);
assertEquals(1, ms.getResponses().length);
return ms.getResponses()[0].getPropertyNames(HttpStatus.SC_OK);
}
use of org.apache.jackrabbit.webdav.client.methods.HttpPropfind in project jackrabbit by apache.
the class DavPropertyTest method doPropFindByProp.
private DavPropertyNameSet doPropFindByProp(String uri, DavPropertyNameSet props) throws Exception {
HttpPropfind request = new HttpPropfind(uri, DavConstants.PROPFIND_BY_PROPERTY, props, DavConstants.DEPTH_0);
HttpClient cl = rs.getClient(si);
HttpResponse response = cl.execute(request, rs.getContext(si));
request.checkSuccess(response);
MultiStatus ms = request.getResponseBodyAsMultiStatus(response);
assertEquals(1, ms.getResponses().length);
return ms.getResponses()[0].getPropertyNames(HttpStatus.SC_OK);
}
Aggregations