Search in sources :

Example 1 with AclResource

use of org.apache.jackrabbit.webdav.security.AclResource in project jackrabbit by apache.

the class AbstractWebdavServlet method doAcl.

/**
 * The ACL method
 *
 * @param request
 * @param response
 * @param resource
 * @throws DavException
 * @throws IOException
 */
protected void doAcl(WebdavRequest request, WebdavResponse response, DavResource resource) throws DavException, IOException {
    if (!(resource instanceof AclResource)) {
        response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
        return;
    }
    Document doc = request.getRequestDocument();
    if (doc == null) {
        throw new DavException(DavServletResponse.SC_BAD_REQUEST, "ACL request requires a DAV:acl body.");
    }
    AclProperty acl = AclProperty.createFromXml(doc.getDocumentElement());
    ((AclResource) resource).alterAcl(acl);
}
Also used : AclProperty(org.apache.jackrabbit.webdav.security.AclProperty) AclResource(org.apache.jackrabbit.webdav.security.AclResource) DavException(org.apache.jackrabbit.webdav.DavException) Document(org.w3c.dom.Document)

Example 2 with AclResource

use of org.apache.jackrabbit.webdav.security.AclResource in project jackrabbit by apache.

the class AbstractWebdavServlet method doReport.

/**
 * The REPORT method
 *
 * @param request
 * @param response
 * @param resource
 * @throws DavException
 * @throws IOException
 */
protected void doReport(WebdavRequest request, WebdavResponse response, DavResource resource) throws DavException, IOException {
    ReportInfo info = request.getReportInfo();
    Report report;
    if (resource instanceof DeltaVResource) {
        report = ((DeltaVResource) resource).getReport(info);
    } else if (resource instanceof AclResource) {
        report = ((AclResource) resource).getReport(info);
    } else {
        response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
        return;
    }
    int statusCode = (report.isMultiStatusReport()) ? DavServletResponse.SC_MULTI_STATUS : DavServletResponse.SC_OK;
    addHintAboutPotentialRequestEncodings(request, response);
    response.sendXmlResponse(report, statusCode, acceptsGzipEncoding(request) ? Collections.singletonList("gzip") : Collections.emptyList());
}
Also used : Report(org.apache.jackrabbit.webdav.version.report.Report) AclResource(org.apache.jackrabbit.webdav.security.AclResource) ReportInfo(org.apache.jackrabbit.webdav.version.report.ReportInfo) DeltaVResource(org.apache.jackrabbit.webdav.version.DeltaVResource)

Aggregations

AclResource (org.apache.jackrabbit.webdav.security.AclResource)2 DavException (org.apache.jackrabbit.webdav.DavException)1 AclProperty (org.apache.jackrabbit.webdav.security.AclProperty)1 DeltaVResource (org.apache.jackrabbit.webdav.version.DeltaVResource)1 Report (org.apache.jackrabbit.webdav.version.report.Report)1 ReportInfo (org.apache.jackrabbit.webdav.version.report.ReportInfo)1 Document (org.w3c.dom.Document)1