Search in sources :

Example 1 with UpdateInfo

use of org.apache.jackrabbit.webdav.version.UpdateInfo in project jackrabbit by apache.

the class AbstractWebdavServlet method doUpdate.

/**
     * The UPDATE method
     *
     * @param request
     * @param response
     * @param resource
     * @throws DavException
     * @throws IOException
     */
protected void doUpdate(WebdavRequest request, WebdavResponse response, DavResource resource) throws DavException, IOException {
    if (!(resource instanceof VersionControlledResource)) {
        response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
        return;
    }
    UpdateInfo info = request.getUpdateInfo();
    MultiStatus ms = ((VersionControlledResource) resource).update(info);
    response.sendMultiStatus(ms);
}
Also used : MultiStatus(org.apache.jackrabbit.webdav.MultiStatus) VersionControlledResource(org.apache.jackrabbit.webdav.version.VersionControlledResource) UpdateInfo(org.apache.jackrabbit.webdav.version.UpdateInfo)

Example 2 with UpdateInfo

use of org.apache.jackrabbit.webdav.version.UpdateInfo in project jackrabbit by apache.

the class RepositoryServiceImpl method update.

private void update(String uri, Path relPath, String[] updateSource, int updateType, boolean removeExisting, SessionInfo sessionInfo) throws RepositoryException {
    HttpUpdate request = null;
    try {
        UpdateInfo uInfo;
        String[] tmpUpdateSource = obtainAbsolutePathsFromUris(updateSource);
        if (removeExisting || relPath != null) {
            Element uElem = UpdateInfo.createUpdateElement(tmpUpdateSource, updateType, DomUtil.createDocument());
            if (removeExisting) {
                DomUtil.addChildElement(uElem, JcrRemotingConstants.XML_REMOVEEXISTING, ItemResourceConstants.NAMESPACE);
            }
            if (relPath != null) {
                DomUtil.addChildElement(uElem, JcrRemotingConstants.XML_RELPATH, ItemResourceConstants.NAMESPACE, getNamePathResolver(sessionInfo).getJCRPath(relPath));
            }
            uInfo = new UpdateInfo(uElem);
        } else {
            uInfo = new UpdateInfo(tmpUpdateSource, updateType, new DavPropertyNameSet());
        }
        request = new HttpUpdate(uri, uInfo);
        initMethod(request, sessionInfo, !isUnLockMethod(request));
        HttpResponse response = executeRequest(sessionInfo, request);
        request.checkSuccess(response);
    } catch (IOException e) {
        throw new RepositoryException(e);
    } catch (ParserConfigurationException e) {
        throw new RepositoryException(e);
    } catch (DavException e) {
        throw ExceptionConverter.generate(e);
    } finally {
        if (request != null) {
            request.releaseConnection();
        }
    }
}
Also used : HttpUpdate(org.apache.jackrabbit.webdav.client.methods.HttpUpdate) DavException(org.apache.jackrabbit.webdav.DavException) Element(org.w3c.dom.Element) DavPropertyNameSet(org.apache.jackrabbit.webdav.property.DavPropertyNameSet) HttpResponse(org.apache.http.HttpResponse) RepositoryException(javax.jcr.RepositoryException) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) UpdateInfo(org.apache.jackrabbit.webdav.version.UpdateInfo)

Example 3 with UpdateInfo

use of org.apache.jackrabbit.webdav.version.UpdateInfo in project jackrabbit by apache.

the class WebdavRequestImpl method getUpdateInfo.

/**
     * @see org.apache.jackrabbit.webdav.version.DeltaVServletRequest#getUpdateInfo()
     */
public UpdateInfo getUpdateInfo() throws DavException {
    UpdateInfo uInfo = null;
    Document requestDocument = getRequestDocument();
    if (requestDocument != null) {
        uInfo = new UpdateInfo(requestDocument.getDocumentElement());
    }
    return uInfo;
}
Also used : Document(org.w3c.dom.Document) UpdateInfo(org.apache.jackrabbit.webdav.version.UpdateInfo)

Aggregations

UpdateInfo (org.apache.jackrabbit.webdav.version.UpdateInfo)3 IOException (java.io.IOException)1 RepositoryException (javax.jcr.RepositoryException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 HttpResponse (org.apache.http.HttpResponse)1 DavException (org.apache.jackrabbit.webdav.DavException)1 MultiStatus (org.apache.jackrabbit.webdav.MultiStatus)1 HttpUpdate (org.apache.jackrabbit.webdav.client.methods.HttpUpdate)1 DavPropertyNameSet (org.apache.jackrabbit.webdav.property.DavPropertyNameSet)1 VersionControlledResource (org.apache.jackrabbit.webdav.version.VersionControlledResource)1 Document (org.w3c.dom.Document)1 Element (org.w3c.dom.Element)1