use of org.apache.jackrabbit.webdav.MultiStatus 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.MultiStatus 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.MultiStatus 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);
}
use of org.apache.jackrabbit.webdav.MultiStatus in project jackrabbit by apache.
the class AbstractWebdavServlet method doPropPatch.
/**
* The PROPPATCH method
*
* @param request
* @param response
* @param resource
* @throws IOException
*/
protected void doPropPatch(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException {
List<? extends PropEntry> changeList = request.getPropPatchChangeList();
if (changeList.isEmpty()) {
response.sendError(DavServletResponse.SC_BAD_REQUEST);
return;
}
MultiStatus ms = new MultiStatus();
MultiStatusResponse msr = resource.alterProperties(changeList);
ms.addResponse(msr);
response.sendMultiStatus(ms);
}
use of org.apache.jackrabbit.webdav.MultiStatus in project jackrabbit by apache.
the class AbstractWebdavServlet method doPropFind.
/**
* The PROPFIND method
*
* @param request
* @param response
* @param resource
* @throws IOException
*/
protected void doPropFind(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException {
if (!resource.exists()) {
response.sendError(DavServletResponse.SC_NOT_FOUND);
return;
}
int depth = request.getDepth(DEPTH_INFINITY);
DavPropertyNameSet requestProperties = request.getPropFindProperties();
int propfindType = request.getPropFindType();
MultiStatus mstatus = new MultiStatus();
mstatus.addResourceProperties(resource, requestProperties, propfindType, depth);
response.sendMultiStatus(mstatus);
}
Aggregations