Package org.apache.jackrabbit.webdav

Examples of org.apache.jackrabbit.webdav.DavException


    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:privileges element must at least contain a single DAV:href child.");
        }
        // immediately build the final multistatus element
        Element hrefElem = info.getContentElement(DavConstants.XML_HREF, DavConstants.NAMESPACE);
        String href = DomUtil.getTextTrim(hrefElem);
        DavResourceLocator resourceLoc = resource.getLocator();
View Full Code Here


        // delegate validation to abstract super class
        super.init(resource, info);
        try {
            nsReg = getRepositorySession().getWorkspace().getNamespaceRegistry();
        } catch (RepositoryException e) {
            throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
View Full Code Here

        if (lock != null && lock.isExpired()) {
            locks.remove(resourcePath);
            lock = null;
        }
        if (lock != null) {
            throw new DavException(DavServletResponse.SC_LOCKED, "Resource '" + resource.getResourcePath() + "' already holds a lock.");
        }
        // test if the new lock would conflict with any lock inherited from the
        // collection or with a lock present on any member resource.
        for (String key : locks.keySet()) {
            // TODO: is check for lock on internal-member correct?
            if (Text.isDescendant(key, resourcePath)) {
                ActiveLock l = locks.get(key);
                if (l.isDeep() || (key.equals(Text.getRelativeParent(resourcePath, 1)) && !resource.isCollection())) {
                    throw new DavException(DavServletResponse.SC_LOCKED, "Resource '" + resource.getResourcePath() + "' already inherits a lock by its collection.");
                }
            } else if (Text.isDescendant(resourcePath, key)) {
                if (lockInfo.isDeep() || isInternalMember(resource, key)) {
                    throw new DavException(DavServletResponse.SC_CONFLICT, "Resource '" + resource.getResourcePath() + "' cannot be locked due to a lock present on the member resource '" + key + "'.");
                }

            }
        }
        lock = new DefaultActiveLock(lockInfo);
View Full Code Here

     */
    public ActiveLock refreshLock(LockInfo lockInfo, String lockToken, DavResource resource)
            throws DavException {
        ActiveLock lock = getLock(lockInfo.getType(), lockInfo.getScope(), resource);
        if (lock == null) {
            throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
        } else if (!lock.getToken().equals(lockToken)) {
            throw new DavException(DavServletResponse.SC_LOCKED);
        }
        lock.setTimeout(lockInfo.getTimeout());
        return lock;
    }
View Full Code Here

     * @param resource that is the lock holder
     */
    public synchronized void releaseLock(String lockToken, DavResource resource)
            throws DavException {
        if (!locks.containsKey(resource.getResourcePath())) {
            throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
        }
        ActiveLock lock = locks.get(resource.getResourcePath());
        if (lock.getToken().equals(lockToken)) {
            locks.remove(resource.getResourcePath());
        } else {
            throw new DavException(DavServletResponse.SC_LOCKED);
        }
    }
View Full Code Here

     * @return new <code>AclProperty</code>
     * @throws DavException
     */
    public static AclProperty createFromXml(Element aclElement) throws DavException {
        if (!DomUtil.matches(aclElement, SecurityConstants.ACL.getName(), SecurityConstants.ACL.getNamespace())) {
            throw new DavException(DavServletResponse.SC_BAD_REQUEST, "ACL request requires a DAV:acl body.");
        }
        List<Ace> aces = new ArrayList<Ace>();
        ElementIterator it = DomUtil.getChildren(aclElement, Ace.XML_ACE, SecurityConstants.NAMESPACE);
        while (it.hasNext()) {
            Element aceElem = it.nextElement();
View Full Code Here

    @Override
    public void init(DavResource resource, ReportInfo info) throws DavException {
        super.init(resource, info);
        // make sure the request body contains all mandatory elements
        if (!info.containsContentElement(XML_PROPERTY_SEARCH, SecurityConstants.NAMESPACE)) {
            throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Request body must contain at least a single DAV:property-search element.");
        }
        List<Element> psElements = info.getContentElements(XML_PROPERTY_SEARCH, SecurityConstants.NAMESPACE);
        searchArguments = new SearchArgument[psElements.size()];
        int i = 0;
        for (Element psElement : psElements) {
View Full Code Here

    /**
     * @see Report#init(DavResource, ReportInfo)
     */
    public void init(DavResource resource, ReportInfo info) throws DavException {
        if (resource == null || info == null) {
            throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Unable to run report: WebDAV Resource and ReportInfo must not be null.");
        }
        if (!getType().isRequestedReportType(info)) {
            throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Expected report type: '" + getType().getReportName() + "', found: '" + info.getReportName() + ";" + "'.");
        }
        if (info.getDepth() > DavConstants.DEPTH_0) {
            throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid Depth header: " + info.getDepth());
        }
    }
View Full Code Here

            HttpClient client = getClient(sessionInfo);
            client.executeMethod(method);

            int status = method.getStatusCode();
            if (status != DavServletResponse.SC_OK) {
                throw ExceptionConverter.generate(new DavException(status, method.getStatusText()));
            }

            Path path = uriResolver.getQPath(uri, sessionInfo);

            String ct = null;
View Full Code Here

            Element pp = info.getContentElement(XML_PRINCIPAL_PROPERTY, SecurityConstants.NAMESPACE);
            principalPropertyName = DavPropertyName.createFromXml(DomUtil.getFirstChildElement(pp));
        } else if (info.containsContentElement(XML_SELF, SecurityConstants.NAMESPACE)) {
            principalPropertyName = SecurityConstants.PRINCIPAL_URL;
        } else {
            throw new DavException(DavServletResponse.SC_BAD_REQUEST, "DAV:self or DAV:principal-property element required within report info.");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.webdav.DavException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.