You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by pn...@apache.org on 2002/04/12 17:39:22 UTC
cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method VersionControlMethod.java
pnever 02/04/12 08:39:22
Modified: src/webdav/server/org/apache/slide/webdav/method
VersionControlMethod.java
Log:
Additional semantics for the workspace feature ... see 6.7 of RFC3253
Revision Changes Path
1.11 +46 -6 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java
Index: VersionControlMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- VersionControlMethod.java 5 Apr 2002 05:45:10 -0000 1.10
+++ VersionControlMethod.java 12 Apr 2002 15:39:22 -0000 1.11
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java,v 1.10 2002/04/05 05:45:10 juergen Exp $
- * $Revision: 1.10 $
- * $Date: 2002/04/05 05:45:10 $
+ * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/VersionControlMethod.java,v 1.11 2002/04/12 15:39:22 pnever Exp $
+ * $Revision: 1.11 $
+ * $Date: 2002/04/12 15:39:22 $
*
* ====================================================================
*
@@ -109,6 +109,12 @@
private String resourcePath;
/**
+ * The VERSION-CONTROL request can be used to create a new VCR for an existing
+ * version history (see 6.7 of RFC3253)
+ */
+ private String existingVersionPath;
+
+ /**
* VERSION-CONTROL method constructor.
*
* @param token Namespace access token
@@ -134,22 +140,53 @@
if (resourcePath == null) {
resourcePath = "/";
}
+
+ if( req.getContentLength() > 0 ) {
try{
retrieveRequestContent();
+ Element vce = getRequestContent().getRootElement();
+ Element ve = null;
+ if( vce == null || !vce.getName().equals(E_VERSION_CONTROL) ) {
+ Domain.warn( "Root element must be "+E_VERSION_CONTROL );
+ resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
+ throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
+ }
+ Iterator i = vce.getChildren().iterator();
+ while( i.hasNext() ) {
+ Element e = (Element)i.next();
+ if( e.getName().equals(E_VERSION) ) {
+ // version element found
+ ve = e;
+ // get the href element
+ try {
+ Element hre = (Element)ve.getChildren().get(0);
+ if( hre == null || !hre.getName().equals(E_HREF) )
+ throw new Exception();
+ existingVersionPath = getSlidePath( hre.getText() );
}
- catch (SAXException e){
+ catch( Exception x ) {
+ Domain.warn( E_VERSION+" element must contain "+E_HREF+" element" );
resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
}
- catch (IOException e){
+ break;
+ }
+ }
+ }
+ catch( org.xml.sax.SAXException x ){
+ resp.setStatus(WebdavStatus.SC_BAD_REQUEST);
+ throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
+ }
+ catch( IOException x ){
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
}
- catch (ParserConfigurationException e){
+ catch( javax.xml.parsers.ParserConfigurationException x ){
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
}
}
+ }
/**
* Execute the request.
@@ -164,7 +201,10 @@
try {
VersioningHelper vh = VersioningHelper.getVersioningHelper(
slideToken, token, req, resp, getConfig() );
+ if( existingVersionPath == null )
vh.versionControl( resourcePath );
+ else
+ vh.versionControl( resourcePath, existingVersionPath );
}
catch (PreconditionViolationException e) {
sendPreconditionViolation(e.getViolatedPrecondition());
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>