use of org.apache.jackrabbit.webdav.MultiStatus in project jackrabbit by apache.
the class LocateByUuidReport method init.
/**
* @see Report#init(DavResource, ReportInfo)
*/
@Override
public void init(DavResource resource, ReportInfo info) throws DavException {
// delegate basic validation to super class
super.init(resource, info);
// make also sure, the info contains a DAV:href child element
if (!info.containsContentElement(DavConstants.XML_HREF, DavConstants.NAMESPACE)) {
throw new DavException(DavServletResponse.SC_BAD_REQUEST, "dcr:locate-by-uuid element must at least contain a single DAV:href child.");
}
// immediately build the final multistatus element
try {
Element hrefElem = info.getContentElement(DavConstants.XML_HREF, DavConstants.NAMESPACE);
String uuid = DomUtil.getTextTrim(hrefElem);
DavResourceLocator resourceLoc = resource.getLocator();
Node n = getRepositorySession().getNodeByUUID(uuid);
DavResourceLocator loc = resourceLoc.getFactory().createResourceLocator(resourceLoc.getPrefix(), resourceLoc.getWorkspacePath(), n.getPath(), false);
DavResource locatedResource = resource.getFactory().createResource(loc, resource.getSession());
ms = new MultiStatus();
ms.addResourceProperties(locatedResource, info.getPropertyNameSet(), info.getDepth());
} catch (RepositoryException e) {
throw new JcrDavException(e);
}
}
use of org.apache.jackrabbit.webdav.MultiStatus in project jackrabbit by apache.
the class DavPropertyTest method doPropFindNames.
private DavPropertyNameSet doPropFindNames(String uri) throws Exception {
HttpPropfind request = new HttpPropfind(uri, DavConstants.PROPFIND_PROPERTY_NAMES, 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 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.MultiStatus in project jackrabbit by apache.
the class LocateByHistoryReport method getMultiStatus.
/**
* Retrieve the <code>MultiStatus</code> that is returned in response to a locate-by-history
* report request.
*
* @return
* @throws NullPointerException if info or resource is <code>null</code>.
*/
private MultiStatus getMultiStatus() {
MultiStatus ms = new MultiStatus();
buildResponse(resource, info.getPropertyNameSet(), info.getDepth(), ms);
return ms;
}
use of org.apache.jackrabbit.webdav.MultiStatus in project jackrabbit by apache.
the class VersionTreeReport method getMultiStatus.
/**
* Retrieve the <code>MultiStatus</code> that is returned in response to a locate-by-history
* report request.
*
* @return
* @throws NullPointerException if info or resource is <code>null</code>.
*/
private MultiStatus getMultiStatus() {
if (info == null || resource == null) {
throw new NullPointerException("Error while running DAV:version-tree report");
}
MultiStatus ms = new MultiStatus();
buildResponse(resource, info.getPropertyNameSet(), info.getDepth(), ms);
return ms;
}
Aggregations