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);
}
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();
}
}
}
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;
}
Aggregations