cmlenz 2002/06/14 05:24:07
Modified: src/webdav/server/org/apache/slide/webdav WebdavServlet.java
src/webdav/server/org/apache/slide/webdav/method
AbstractMultistatusResponseMethod.java
AclMethod.java CheckinMethod.java
CheckoutMethod.java CopyMethod.java
DeleteMethod.java GetMethod.java HeadMethod.java
LabelMethod.java LockMethod.java MkcolMethod.java
MkworkspaceMethod.java MoveMethod.java
OptionsMethod.java PostMethod.java
PropFindMethod.java PropPatchMethod.java
PutMethod.java ReportMethod.java SearchMethod.java
UncheckoutMethod.java UnlockMethod.java
UpdateMethod.java VersionControlMethod.java
Added: src/webdav/server/org/apache/slide/webdav WebdavMethod.java
src/webdav/server/org/apache/slide/webdav/method
AbstractWebdavMethod.java
Removed: src/webdav/server/org/apache/slide/webdav/method
WebdavMethod.java
Log:
Refactoring of the WebDAV servlet, as announced on slide-dev:
- Added interface org.apache.slide.webdav.WebdavMethod
- Renamed class org.apache.slide.webdav.method.WebdavMethod to
org.apache.slide.webdav.method.AbstractWebdavMethod, and made
it implement org.apache.slide.webdav.WebdavMethod
- No longer passing request & response objects in the constructors of
the WebdavMethod implementations, move logic out of constructors
- WebdavServlet adjusted to use the new constructors, and the new
WebdavMethod interface instead of the old class
I'm pretty sure I've not broken anything here, and the testsuite run didn't
report anything different to before, but you never know ;)
Revision Changes Path
1.45 +64 -64
jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavServlet.java
Index: WebdavServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavServlet.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- WebdavServlet.java 13 Jun 2002 13:10:58 -0000 1.44
+++ WebdavServlet.java 14 Jun 2002 12:24:05 -0000 1.45
@@ -95,13 +95,16 @@
import org.apache.util.DOMUtils;
/**
- * WebDAV Servlet.
+ * The WebDAV servlet. It is responsible for dispatching incoming requests to
+ * implementations of the WebdavMethod interface.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
* @author Dirk Verbeeck
+ * @author <a href="mailto:[EMAIL PROTECTED]">Christopher Lenz</a>
* @version $Revision$
*/
-public class WebdavServlet extends HttpServlet {
+public class WebdavServlet
+ extends HttpServlet {
// -------------------------------------------------------------- Constants
@@ -164,76 +167,73 @@
* @return WebdavMethod
* @exception WebdavException
*/
- protected WebdavMethod createWebdavMethod
- (HttpServletRequest req, HttpServletResponse resp)
+ protected WebdavMethod createWebdavMethod(String name)
throws WebdavException {
- String methodName = req.getMethod();
-
- WebdavMethod resultMethod = null;
WebdavServletConfig config = (WebdavServletConfig)getServletConfig();
- if (methodName.equalsIgnoreCase("GET")) {
- resultMethod = new GetMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("PROPFIND")) {
- resultMethod = new PropFindMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("HEAD")) {
- resultMethod = new HeadMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("LOCK")) {
- resultMethod = new LockMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("UNLOCK")) {
- resultMethod = new UnlockMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("OPTIONS")) {
- resultMethod = new OptionsMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("PUT")) {
- resultMethod = new PutMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("MKCOL")) {
- resultMethod = new MkcolMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("POST")) {
- resultMethod = new PostMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("COPY")) {
- resultMethod = new CopyMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("MOVE")) {
- resultMethod = new MoveMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("DELETE")) {
- resultMethod = new DeleteMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("PROPPATCH")) {
- resultMethod = new PropPatchMethod(token, req, resp,config);
- } else if (methodName.equalsIgnoreCase("SEARCH")) {
- resultMethod = new SearchMethod(token, req, resp,config);
- } else if (methodName.equalsIgnoreCase("ACL")) {
+ WebdavMethod method = null;
+ if (name.equalsIgnoreCase("GET")) {
+ method = new GetMethod(token, config);
+ } else if (name.equalsIgnoreCase("PROPFIND")) {
+ method = new PropFindMethod(token, config);
+ } else if (name.equalsIgnoreCase("HEAD")) {
+ method = new HeadMethod(token, config);
+ } else if (name.equalsIgnoreCase("LOCK")) {
+ method = new LockMethod(token, config);
+ } else if (name.equalsIgnoreCase("UNLOCK")) {
+ method = new UnlockMethod(token, config);
+ } else if (name.equalsIgnoreCase("OPTIONS")) {
+ method = new OptionsMethod(token, config);
+ } else if (name.equalsIgnoreCase("PUT")) {
+ method = new PutMethod(token, config);
+ } else if (name.equalsIgnoreCase("MKCOL")) {
+ method = new MkcolMethod(token, config);
+ } else if (name.equalsIgnoreCase("POST")) {
+ method = new PostMethod(token, config);
+ } else if (name.equalsIgnoreCase("COPY")) {
+ method = new CopyMethod(token, config);
+ } else if (name.equalsIgnoreCase("MOVE")) {
+ method = new MoveMethod(token, config);
+ } else if (name.equalsIgnoreCase("DELETE")) {
+ method = new DeleteMethod(token, config);
+ } else if (name.equalsIgnoreCase("PROPPATCH")) {
+ method = new PropPatchMethod(token, config);
+ } else if (name.equalsIgnoreCase("SEARCH")) {
+ method = new SearchMethod(token, config);
+ } else if (name.equalsIgnoreCase("ACL")) {
if( org.apache.slide.util.Configuration.useIntegratedSecurity() )
- resultMethod = new AclMethod(token, req, resp, config);
- } else if (methodName.equalsIgnoreCase("VERSION-CONTROL")) {
+ method = new AclMethod(token, config);
+ } else if (name.equalsIgnoreCase("VERSION-CONTROL")) {
if( org.apache.slide.util.Configuration.useVersionControl() )
- resultMethod = new VersionControlMethod(token, req, resp,config);
- } else if (methodName.equalsIgnoreCase("REPORT")) {
- resultMethod = new ReportMethod(token, req, resp,config);
- } else if (methodName.equalsIgnoreCase("CHECKIN")) {
+ method = new VersionControlMethod(token, config);
+ } else if (name.equalsIgnoreCase("REPORT")) {
+ method = new ReportMethod(token, config);
+ } else if (name.equalsIgnoreCase("CHECKIN")) {
if( org.apache.slide.util.Configuration.useVersionControl() )
- resultMethod = new CheckinMethod(token, req, resp,config);
- } else if (methodName.equalsIgnoreCase("CHECKOUT")) {
+ method = new CheckinMethod(token, config);
+ } else if (name.equalsIgnoreCase("CHECKOUT")) {
if( org.apache.slide.util.Configuration.useVersionControl() )
- resultMethod = new CheckoutMethod(token, req, resp,config);
- } else if (methodName.equalsIgnoreCase("UNCHECKOUT")) {
+ method = new CheckoutMethod(token, config);
+ } else if (name.equalsIgnoreCase("UNCHECKOUT")) {
if( org.apache.slide.util.Configuration.useVersionControl() )
- resultMethod = new UncheckoutMethod(token, req, resp,config);
- } else if (methodName.equalsIgnoreCase("MKWORKSPACE")) {
+ method = new UncheckoutMethod(token, config);
+ } else if (name.equalsIgnoreCase("MKWORKSPACE")) {
if( org.apache.slide.util.Configuration.useVersionControl() )
- resultMethod = new MkworkspaceMethod(token, req, resp,config);
- } else if (methodName.equalsIgnoreCase("LABEL")) {
+ method = new MkworkspaceMethod(token, config);
+ } else if (name.equalsIgnoreCase("LABEL")) {
if( org.apache.slide.util.Configuration.useVersionControl() )
- resultMethod = new LabelMethod(token, req, resp,config);
- } else if (methodName.equalsIgnoreCase("UPDATE")) {
+ method = new LabelMethod(token, config);
+ } else if (name.equalsIgnoreCase("UPDATE")) {
if( org.apache.slide.util.Configuration.useVersionControl() )
- resultMethod = new UpdateMethod(token, req, resp,config);
+ method = new UpdateMethod(token, config);
}
- if (resultMethod == null) {
+ if (method == null) {
throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
}
- return resultMethod;
+ return method;
}
@@ -281,19 +281,19 @@
resp.setStatus(WebdavStatus.SC_OK);
- String methodName = req.getMethod();
+ String name = req.getMethod();
WebdavServletConfig config =
(WebdavServletConfig)getServletConfig();
- if ((methodName.equalsIgnoreCase("GET") ||
- methodName.equalsIgnoreCase("POST")) &&
+ if ((name.equalsIgnoreCase("GET") ||
+ name.equalsIgnoreCase("POST")) &&
WebdavUtils.isCollection(token, req, config)) {
// let the standard doGet() / doPost() methods handle
// GET/POST requests on collections (to display a directory
// index pag or something similar)
super.service(req, resp);
} else {
- WebdavMethod method = createWebdavMethod(req, resp);
- method.run();
+ WebdavMethod method = createWebdavMethod(req.getMethod());
+ method.run(req, resp);
}
// if logging for the request/response is required
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavMethod.java
Index: WebdavMethod.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavMethod.java,v
1.1 2002/06/14 12:24:05 cmlenz Exp $
* $Revision: 1.1 $
* $Date: 2002/06/14 12:24:05 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Slide", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.slide.webdav;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Basic interface for classes that implement processing of a specific WebDAV
* method.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
* @author Christopher Lenz
*/
public interface WebdavMethod {
// --------------------------------------------------------- Public Methods
/**
* Called by the WebDAV servlet to delegate the actual processing of the
* request to the method implementation.
*
* @throws WebdavException if some error occurred while processing the
* request. HTTP/WebDAV status code will be
* available through
* {@link WebdavException#getStatusCode
WebdavException.getStatusCode()}
*/
public void run(HttpServletRequest req, HttpServletResponse resp)
throws WebdavException;
}
1.26 +10 -14
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java
Index: AbstractMultistatusResponseMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- AbstractMultistatusResponseMethod.java 28 May 2002 12:39:40 -0000 1.25
+++ AbstractMultistatusResponseMethod.java 14 Jun 2002 12:24:05 -0000 1.26
@@ -96,7 +96,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
* @author Juergen Pill
*/
-public abstract class AbstractMultistatusResponseMethod extends WebdavMethod
implements WebdavConstants {
+public abstract class AbstractMultistatusResponseMethod extends
AbstractWebdavMethod implements WebdavConstants {
// ----------------------------------------------------- Instance Variables
@@ -125,17 +125,13 @@
/**
* Constructor.
- *
- * @param token Namespace access token
- * @param requestUri Request URI
- * @param principal Principal object, given by the servlet container
- * @param req HTTP request
- * @param resp HTTP response
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public AbstractMultistatusResponseMethod
- (NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
+ public AbstractMultistatusResponseMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
1.23 +13 -14
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java
Index: AclMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AclMethod.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- AclMethod.java 6 Jun 2002 08:16:49 -0000 1.22
+++ AclMethod.java 14 Jun 2002 12:24:05 -0000 1.23
@@ -93,7 +93,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
* @author Dirk Verbeeck
*/
-public class AclMethod extends WebdavMethod implements AclConstants {
+public class AclMethod extends AbstractWebdavMethod implements AclConstants {
// -------------------------------------------------------------- Constants
@@ -146,17 +146,13 @@
/**
- * ACL method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public AclMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- readRequestContent();
- this.config = token.getNamespaceConfig();
+ public AclMethod(NamespaceAccessToken token, WebdavServletConfig config) {
+ super(token, config);
}
@@ -175,6 +171,9 @@
if (resourcePath == null) {
resourcePath = "/";
}
+
+ readRequestContent();
+ this.config = token.getNamespaceConfig();
try {
1.9 +20 -14
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckinMethod.java
Index: CheckinMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckinMethod.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- CheckinMethod.java 28 May 2002 12:39:40 -0000 1.8
+++ CheckinMethod.java 14 Jun 2002 12:24:05 -0000 1.9
@@ -89,25 +89,27 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ralf Stuckert</a>
*/
-public class CheckinMethod extends WebdavMethod implements DeltavConstants {
+public class CheckinMethod extends AbstractWebdavMethod implements DeltavConstants {
/** Resource to be written. */
private String resourcePath;
/** Marshalling variables */
private boolean forkOk = false;
-
+
+
+ // ----------------------------------------------------------- Constructors
+
+
/**
- * CHECKIN method constructor.
- *
- * @param token the Namespace access token.
- * @param req the HTTP request.
- * @param resp the HTTP response.
- * @param config the servlet config.
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public CheckinMethod( NamespaceAccessToken token, HttpServletRequest req,
HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- readRequestContent();
+ public CheckinMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
/**
@@ -117,11 +119,15 @@
* @throws IOException
*/
protected void parseRequest() throws WebdavException {
+
resourcePath = requestUri;
if (resourcePath == null) {
resourcePath = "/";
}
+
+
if( req.getContentLength() > 0 ) {
+ readRequestContent();
try{
Element cie = parseRequestContent().getRootElement();
if( cie == null || !cie.getName().equals(E_CHECKIN) ) {
1.11 +22 -18
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckoutMethod.java
Index: CheckoutMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckoutMethod.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- CheckoutMethod.java 28 May 2002 12:39:40 -0000 1.10
+++ CheckoutMethod.java 14 Jun 2002 12:24:05 -0000 1.11
@@ -92,7 +92,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ralf Stuckert</a>
*/
-public class CheckoutMethod extends WebdavMethod implements DeltavConstants {
+public class CheckoutMethod extends AbstractWebdavMethod implements DeltavConstants
{
/** Resource to be written. */
private String resourcePath;
@@ -106,22 +106,19 @@
*/
protected VersioningHelper versioningHelper = null;
+
+ // ----------------------------------------------------------- Constructors
+
+
/**
- * CHECKOUT method constructor.
- *
- * @param token the Namespace access token.
- * @param req the HTTP request.
- * @param resp the HTTP response.
- * @param config the servlet config.
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public CheckoutMethod( NamespaceAccessToken token, HttpServletRequest req,
HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
- token,
- req,
- resp,
- config);
- readRequestContent();
+ public CheckoutMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
/**
@@ -131,10 +128,16 @@
* @throws IOException
*/
protected void parseRequest() throws WebdavException {
+
resourcePath = requestUri;
if (resourcePath == null) {
resourcePath = "/";
}
+
+ versioningHelper =
+ VersioningHelper.getVersioningHelper(slideToken, token, req, resp,
+ config);
+
// evaluate "Label" header
if (Configuration.useVersionControl()) {
try {
@@ -162,6 +165,7 @@
if( req.getContentLength() > 0 ) {
+ readRequestContent();
try{
Element coe = parseRequestContent().getRootElement();
if( coe == null || !coe.getName().equals(E_CHECKOUT) ) {
1.41 +13 -19
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java
Index: CopyMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- CopyMethod.java 10 Jun 2002 06:15:42 -0000 1.40
+++ CopyMethod.java 14 Jun 2002 12:24:05 -0000 1.41
@@ -122,27 +122,17 @@
protected String labelHeader = null;
-
// ----------------------------------------------------------- Constructors
/**
- * COPY method constructor.
- *
- * @param token Namespace access token
- * @param requestUri Request URI
- * @param principal Principal object, given by the servlet container
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public CopyMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
- token,
- req,
- resp,
- config);
+ public CopyMethod(NamespaceAccessToken token, WebdavServletConfig config) {
+ super(token, config);
}
@@ -155,6 +145,10 @@
*/
protected void parseRequest() throws WebdavException {
super.parseRequest();
+
+ versioningHelper =
+ VersioningHelper.getVersioningHelper(slideToken, token, req, resp,
+ config);
labelHeader = req.getHeader(DeltavConstants.H_LABEL);
}
1.25 +15 -17
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java
Index: DeleteMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- DeleteMethod.java 20 May 2002 12:10:14 -0000 1.24
+++ DeleteMethod.java 14 Jun 2002 12:24:05 -0000 1.25
@@ -131,24 +131,19 @@
*/
protected VersioningHelper versioningHelper = null;
+
// ----------------------------------------------------------- Constructors
/**
- * DELETE method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public DeleteMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
- token,
- req,
- resp,
- config);
+ public DeleteMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
@@ -162,6 +157,9 @@
*/
protected void parseRequest()
throws WebdavException {
+ versioningHelper =
+ VersioningHelper.getVersioningHelper(slideToken, token, req, resp,
+ config);
toDelete = requestUri;
if (toDelete == null) {
toDelete = "/";
1.30 +13 -15
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/GetMethod.java
Index: GetMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/GetMethod.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- GetMethod.java 28 May 2002 12:39:40 -0000 1.29
+++ GetMethod.java 14 Jun 2002 12:24:05 -0000 1.30
@@ -99,7 +99,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
*/
-public class GetMethod extends WebdavMethod {
+public class GetMethod extends AbstractWebdavMethod {
// -------------------------------------------------------------- Constants
@@ -160,17 +160,13 @@
/**
- * GET Method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
- */
- public GetMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- vHelp = VersioningHelper.getVersioningHelper(
- slideToken, token, req, resp, getConfig() );
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
+ */
+ public GetMethod(NamespaceAccessToken token, WebdavServletConfig config) {
+ super(token, config);
}
@@ -182,6 +178,8 @@
*/
protected void parseRequest()
throws WebdavException {
+ vHelp = VersioningHelper.getVersioningHelper(
+ slideToken, token, req, resp, getConfig() );
resourcePath = requestUri;
if (resourcePath == null) {
resourcePath = "/";
1.6 +10 -10
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/HeadMethod.java
Index: HeadMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/HeadMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HeadMethod.java 25 Apr 2002 21:12:25 -0000 1.5
+++ HeadMethod.java 14 Jun 2002 12:24:05 -0000 1.6
@@ -88,17 +88,17 @@
/**
- * HEAD Method constructor.
+ * Constructor.
*
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public HeadMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
+ public HeadMethod(NamespaceAccessToken token, WebdavServletConfig config) {
+ super(token, config);
+
printContent = false;
}
}
+
1.9 +19 -18
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LabelMethod.java
Index: LabelMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LabelMethod.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- LabelMethod.java 3 Jun 2002 12:25:53 -0000 1.8
+++ LabelMethod.java 14 Jun 2002 12:24:05 -0000 1.9
@@ -177,23 +177,18 @@
protected String labelHeader = null;
+ // ----------------------------------------------------------- Constructors
+
/**
- * LABEL method constructor.
- *
- * @param token the Namespace access token.
- * @param req the HTTP request.
- * @param resp the HTTP response.
- * @param config the servlet config.
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public LabelMethod( NamespaceAccessToken token, HttpServletRequest req,
HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- readRequestContent();
- versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
- token,
- req,
- resp,
- config);
+ public LabelMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
/**
@@ -203,6 +198,12 @@
* @throws IOException
*/
protected void parseRequest() throws WebdavException {
+ readRequestContent();
+ versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
+ token,
+ req,
+ resp,
+ config);
resourcePath = requestUri;
if (resourcePath == null) {
resourcePath = "/";
1.38 +15 -17
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LockMethod.java
Index: LockMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LockMethod.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- LockMethod.java 29 May 2002 08:19:44 -0000 1.37
+++ LockMethod.java 14 Jun 2002 12:24:05 -0000 1.38
@@ -194,23 +194,18 @@
*/
protected String serverURL = null;
+
// ----------------------------------------------------------- Constructors
/**
- * LOCK method constructor.
- *
- * @param token Namespace access token
- * @param requestUri Request URI
- * @param principal Principal object, given by the servlet container
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public LockMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token);
- readRequestContent();
+ public LockMethod(NamespaceAccessToken token, WebdavServletConfig config) {
+ super(token, config);
}
@@ -225,8 +220,11 @@
protected void parseRequest()
throws WebdavException {
+ propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token);
+ readRequestContent();
+
serverURL = HTTP_PROTOCOL + req.getServerName()+ ":" + req.getServerPort();
-
+
// Loads the associated object from the store.
lockInfo_lockSubject = requestUri;
if (lockInfo_lockSubject == null) {
1.24 +13 -19
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkcolMethod.java
Index: MkcolMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkcolMethod.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- MkcolMethod.java 20 May 2002 12:10:14 -0000 1.23
+++ MkcolMethod.java 14 Jun 2002 12:24:05 -0000 1.24
@@ -88,11 +88,9 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
*/
-public class MkcolMethod extends WebdavMethod
-implements DeltavConstants {
-
-
- // -------------------------------------------------------------- Constants
+public class MkcolMethod
+ extends AbstractWebdavMethod
+ implements DeltavConstants {
// ----------------------------------------------------- Instance Variables
@@ -104,19 +102,15 @@
private String colName;
- // ----------------------------------------------------------- Constructors
-
-
/**
- * GET Method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public MkcolMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
+ public MkcolMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
1.6 +14 -15
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkworkspaceMethod.java
Index: MkworkspaceMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkworkspaceMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MkworkspaceMethod.java 28 May 2002 12:39:40 -0000 1.5
+++ MkworkspaceMethod.java 14 Jun 2002 12:24:05 -0000 1.6
@@ -104,7 +104,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Nevermann</a>
*/
-public class MkworkspaceMethod extends WebdavMethod
+public class MkworkspaceMethod extends AbstractWebdavMethod
implements DeltavConstants {
/**
@@ -113,19 +113,18 @@
private String resourcePath;
+ // ----------------------------------------------------------- Constructors
+
+
/**
- * MKWORKSPACE method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public MkworkspaceMethod( NamespaceAccessToken token,
- HttpServletRequest req,
- HttpServletResponse resp,
- WebdavServletConfig config)
- {
- super(token, req, resp, config);
+ public MkworkspaceMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
/**
1.42 +18 -18
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java
Index: MoveMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- MoveMethod.java 20 May 2002 12:10:14 -0000 1.41
+++ MoveMethod.java 14 Jun 2002 12:24:05 -0000 1.42
@@ -149,25 +149,18 @@
*/
protected Element literal = null;
+
// ----------------------------------------------------------- Constructors
/**
- * MOVE method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public MoveMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
- token,
- req,
- resp,
- config);
- propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token);
+ public MoveMethod(NamespaceAccessToken token, WebdavServletConfig config) {
+ super(token, config);
}
@@ -182,6 +175,13 @@
*/
protected void executeRequest()
throws WebdavException, IOException {
+
+ versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
+ token,
+ req,
+ resp,
+ config);
+ propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token);
// Prevent dirty reads
slideToken.setForceStoreEnlistment(true);
1.27 +12 -7
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/OptionsMethod.java
Index: OptionsMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/OptionsMethod.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- OptionsMethod.java 28 May 2002 12:39:40 -0000 1.26
+++ OptionsMethod.java 14 Jun 2002 12:24:05 -0000 1.27
@@ -99,7 +99,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
*/
-public class OptionsMethod extends WebdavMethod
+public class OptionsMethod extends AbstractWebdavMethod
implements DeltavConstants, AclConstants {
// An XML outputter
@@ -115,10 +115,15 @@
// ----------------------------------------------------------- Constructors
- public OptionsMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp,
+ /**
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
+ */
+ public OptionsMethod(NamespaceAccessToken token,
WebdavServletConfig config) {
- super(token, req, resp, config);
+ super(token, config);
}
protected void parseRequest() throws WebdavException {
1.8 +11 -6
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PostMethod.java
Index: PostMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PostMethod.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PostMethod.java 25 Apr 2002 21:27:31 -0000 1.7
+++ PostMethod.java 14 Jun 2002 12:24:05 -0000 1.8
@@ -83,9 +83,14 @@
// ----------------------------------------------------------- Constructors
- public PostMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
+ /**
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
+ */
+ public PostMethod(NamespaceAccessToken token, WebdavServletConfig config) {
+ super(token, config);
}
1.74 +21 -21
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java
Index: PropFindMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- PropFindMethod.java 28 May 2002 12:39:40 -0000 1.73
+++ PropFindMethod.java 14 Jun 2002 12:24:05 -0000 1.74
@@ -108,7 +108,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
*/
-public class PropFindMethod extends WebdavMethod implements DeltavConstants,
AclConstants {
+public class PropFindMethod extends AbstractWebdavMethod implements
DeltavConstants, AclConstants {
// -------------------------------------------------------------- Constants
@@ -183,29 +183,19 @@
*/
protected String labelHeader = null;
+
// ----------------------------------------------------------- Constructors
/**
- * PROPFIND method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public PropFindMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp,
+ public PropFindMethod(NamespaceAccessToken token,
WebdavServletConfig config) {
- super(token, req, resp, config);
- versioningHelper = VersioningHelper.getVersioningHelper(
- slideToken, token, req, resp, getConfig() );
- readRequestContent();
-
- depth = INFINITY;
- propFindType = FIND_ALL_PROP;
- String pval = getConfig().getInitParameter( "allpropIncludesDeltav" );
- if( "true".equalsIgnoreCase(pval) )
- allpropIncludesDeltav = true;
+ super(token, config);
}
@@ -218,6 +208,16 @@
* @exception WebdavException Bad request
*/
protected void parseRequest() throws WebdavException {
+
+ versioningHelper = VersioningHelper.getVersioningHelper(
+ slideToken, token, req, resp, getConfig() );
+ readRequestContent();
+
+ depth = INFINITY;
+ propFindType = FIND_ALL_PROP;
+ String pval = getConfig().getInitParameter( "allpropIncludesDeltav" );
+ if( "true".equalsIgnoreCase(pval) )
+ allpropIncludesDeltav = true;
resourcePath = requestUri;
if (resourcePath == null) {
1.53 +17 -18
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java
Index: PropPatchMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- PropPatchMethod.java 3 Jun 2002 11:59:40 -0000 1.52
+++ PropPatchMethod.java 14 Jun 2002 12:24:05 -0000 1.53
@@ -97,7 +97,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
*/
-public class PropPatchMethod extends WebdavMethod implements DeltavConstants {
+public class PropPatchMethod extends AbstractWebdavMethod implements
DeltavConstants {
// -------------------------------------------------------------- Constants
@@ -142,22 +142,14 @@
/**
- * PROPPATCH method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public PropPatchMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp,
+ public PropPatchMethod(NamespaceAccessToken token,
WebdavServletConfig config) {
- super(token, req, resp, config);
- versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
- token,
- req,
- resp,
- config);
- readRequestContent();
+ super(token, config);
}
@@ -171,6 +163,13 @@
*/
protected void parseRequest()
throws WebdavException {
+
+ versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
+ token,
+ req,
+ resp,
+ config);
+ readRequestContent();
resourcePath = requestUri;
if (resourcePath == null) {
1.52 +18 -18
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java
Index: PutMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- PutMethod.java 28 May 2002 12:39:40 -0000 1.51
+++ PutMethod.java 14 Jun 2002 12:24:06 -0000 1.52
@@ -99,8 +99,9 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
*/
-public class PutMethod extends WebdavMethod
-implements DeltavConstants {
+public class PutMethod
+ extends AbstractWebdavMethod
+ implements DeltavConstants {
// -------------------------------------------------------------- Constants
@@ -123,20 +124,13 @@
/**
- * PUT Method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public PutMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
- token,
- req,
- resp,
- config);
+ public PutMethod(NamespaceAccessToken token, WebdavServletConfig config) {
+ super(token, config);
}
@@ -150,6 +144,12 @@
*/
protected void parseRequest()
throws WebdavException {
+ versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
+ token,
+ req,
+ resp,
+ config);
+
resourcePath = requestUri;
if (resourcePath == null) {
resourcePath = "/";
1.34 +19 -15
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java
Index: ReportMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- ReportMethod.java 28 May 2002 12:39:40 -0000 1.33
+++ ReportMethod.java 14 Jun 2002 12:24:06 -0000 1.34
@@ -164,7 +164,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ralf Stuckert</a>
*/
-public class ReportMethod extends WebdavMethod implements DeltavConstants,
AclConstants {
+public class ReportMethod extends AbstractWebdavMethod implements DeltavConstants,
AclConstants {
/**
* String constant for <code>http://</code>.
@@ -257,18 +257,18 @@
protected String serverUri = null;
+ // ----------------------------------------------------------- Constructors
+
+
/**
- * Creates a ReportMethod with the given arguments.
- *
- * @param token the NamespaceAccessToken.
- * @param request the servlet request to process.
- * @param response the servlet resonse.
- * @param servletConfig the servlet configuration.
- *
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public ReportMethod(NamespaceAccessToken token, HttpServletRequest request,
HttpServletResponse response, WebdavServletConfig servletConfig) {
- super(token, request, response, servletConfig);
- versioningHelper = VersioningHelper.getVersioningHelper(slideToken, token,
req, resp, servletConfig);
+ public ReportMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
@@ -279,6 +279,10 @@
* </code> request).
*/
protected void parseRequest() throws WebdavException {
+
+ versioningHelper =
+ VersioningHelper.getVersioningHelper(slideToken, token, req, resp,
+ config);
retrieveResourcePath();
retrieveDepth();
1.23 +16 -11
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java
Index: SearchMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- SearchMethod.java 28 May 2002 12:39:41 -0000 1.22
+++ SearchMethod.java 14 Jun 2002 12:24:06 -0000 1.23
@@ -115,7 +115,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Martin Wallmer</a>
*/
-public class SearchMethod extends WebdavMethod implements WebdavConstants {
+public class SearchMethod extends AbstractWebdavMethod implements WebdavConstants {
// ----------------------------------------------------- Instance variables
@@ -126,16 +126,19 @@
private RequestedProperties requestedProperties = null;
private PropertyRetriever retriever;
+
// ----------------------------------------------------------- Constructors
- public SearchMethod (NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- searchHelper = token.getSearchHelper();
- retriever = new PropertyRetrieverImpl
- (token, slideToken);
-
+ /**
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
+ */
+ public SearchMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
/**
@@ -146,6 +149,8 @@
*/
protected void parseRequest() throws WebdavException {
+ searchHelper = token.getSearchHelper();
+ retriever = new PropertyRetrieverImpl(token, slideToken);
if (Configuration.useSearch ()) {
try {
Element queryElement = getQueryElement();
1.7 +17 -14
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UncheckoutMethod.java
Index: UncheckoutMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UncheckoutMethod.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- UncheckoutMethod.java 28 May 2002 12:39:41 -0000 1.6
+++ UncheckoutMethod.java 14 Jun 2002 12:24:06 -0000 1.7
@@ -87,7 +87,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ralf Stuckert</a>
*/
-public class UncheckoutMethod extends WebdavMethod implements DeltavConstants {
+public class UncheckoutMethod extends AbstractWebdavMethod implements
DeltavConstants {
/**
* String constant for <code>no-cache</code>.
@@ -98,18 +98,20 @@
* Resource to be written.
*/
private String resourcePath;
-
+
+
+ // ----------------------------------------------------------- Constructors
+
+
/**
- * UNCHECKOUT method constructor.
- *
- * @param token the Namespace access token.
- * @param req the HTTP request.
- * @param resp the HTTP response.
- * @param config the servlet config.
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public UncheckoutMethod( NamespaceAccessToken token, HttpServletRequest req,
HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
- readRequestContent();
+ public UncheckoutMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
/**
@@ -119,6 +121,7 @@
* @throws IOException
*/
protected void parseRequest() throws WebdavException {
+ readRequestContent();
resourcePath = requestUri;
if (resourcePath == null) {
resourcePath = "/";
1.23 +11 -12
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java
Index: UnlockMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- UnlockMethod.java 17 May 2002 12:43:56 -0000 1.22
+++ UnlockMethod.java 14 Jun 2002 12:24:06 -0000 1.23
@@ -93,7 +93,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
*/
-public class UnlockMethod extends WebdavMethod {
+public class UnlockMethod extends AbstractWebdavMethod {
// ----------------------------------------------------- Instance Variables
@@ -115,15 +115,14 @@
/**
- * UNLOCK method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public UnlockMethod(NamespaceAccessToken token, HttpServletRequest req,
- HttpServletResponse resp, WebdavServletConfig config) {
- super(token, req, resp, config);
+ public UnlockMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
1.9 +20 -20
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UpdateMethod.java
Index: UpdateMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UpdateMethod.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- UpdateMethod.java 28 May 2002 12:39:41 -0000 1.8
+++ UpdateMethod.java 14 Jun 2002 12:24:06 -0000 1.9
@@ -145,24 +145,18 @@
protected PropertyRetriever propertyRetriever = null;
+ // ----------------------------------------------------------- Constructors
+
+
/**
- * UPDATE method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public UpdateMethod( NamespaceAccessToken token,
- HttpServletRequest req,
- HttpServletResponse resp,
- WebdavServletConfig config)
- {
- super(token, req, resp, config);
- versioningHelper = VersioningHelper.getVersioningHelper(
- slideToken, token, req, resp, getConfig() );
- readRequestContent();
- serverUri = req.getServerName() + ":" + req.getServerPort();
- propertyRetriever = new PropertyRetrieverImpl(token, slideToken);
+ public UpdateMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
/**
@@ -172,11 +166,17 @@
*/
protected void parseRequest() throws WebdavException {
+ versioningHelper = VersioningHelper.getVersioningHelper(
+ slideToken, token, req, resp, getConfig() );
+ readRequestContent();
+ serverUri = req.getServerName() + ":" + req.getServerPort();
+ propertyRetriever = new PropertyRetrieverImpl(token, slideToken);
+
resourcePath = requestUri;
if (resourcePath == null) {
resourcePath = "/";
}
-
+
if( req.getContentLength() == 0 ) {
try {
resp.sendError(WebdavStatus.SC_BAD_REQUEST, "Request body required");
1.16 +17 -16
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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- VersionControlMethod.java 28 May 2002 12:39:41 -0000 1.15
+++ VersionControlMethod.java 14 Jun 2002 12:24:06 -0000 1.16
@@ -98,7 +98,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Nevermann</a>
*/
-public class VersionControlMethod extends WebdavMethod
+public class VersionControlMethod extends AbstractWebdavMethod
implements DeltavConstants {
/**
@@ -112,20 +112,19 @@
*/
private String existingVersionPath;
+
+ // ----------------------------------------------------------- Constructors
+
+
/**
- * VERSION-CONTROL method constructor.
- *
- * @param token Namespace access token
- * @param req HTTP request
- * @param resp HTTP response
+ * Constructor.
+ *
+ * @param token the token for accessing the namespace
+ * @param config configuration of the WebDAV servlet
*/
- public VersionControlMethod( NamespaceAccessToken token,
- HttpServletRequest req,
- HttpServletResponse resp,
- WebdavServletConfig config)
- {
- super(token, req, resp, config);
- readRequestContent();
+ public VersionControlMethod(NamespaceAccessToken token,
+ WebdavServletConfig config) {
+ super(token, config);
}
/**
@@ -134,6 +133,8 @@
* @exception WebdavException
*/
protected void parseRequest() throws WebdavException {
+ readRequestContent();
+
resourcePath = requestUri;
if (resourcePath == null) {
resourcePath = "/";
1.1
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java
Index: AbstractWebdavMethod.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java,v
1.1 2002/06/14 12:24:05 cmlenz Exp $
* $Revision: 1.1 $
* $Date: 2002/06/14 12:24:05 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Slide", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.slide.webdav.method;
import java.security.Principal;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.io.*;
import java.util.*;
import java.net.URLDecoder;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.util.URLUtil;
import org.apache.util.MD5Encoder;
import org.apache.util.WebdavStatus;
import org.apache.slide.common.*;
import org.apache.slide.authenticate.*;
import org.apache.slide.structure.*;
import org.apache.slide.content.*;
import org.apache.slide.content.NodeProperty.NamespaceCache;
import org.apache.slide.lock.*;
import org.apache.slide.search.*;
import org.apache.slide.macro.*;
import org.apache.slide.security.*;
import org.apache.slide.webdav.*;
import org.apache.slide.webdav.util.WebdavUtils;
import org.apache.slide.webdav.util.PreconditionViolationException;
import org.apache.slide.webdav.util.ViolatedPrecondition;
import org.apache.slide.webdav.util.WebdavConstants;
import org.apache.slide.webdav.util.DeltavConstants;
import org.apache.slide.util.logger.Logger;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
/**
* WebDAV method.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
* @author Christopher Lenz
*/
public abstract class AbstractWebdavMethod
implements WebdavMethod {
// -------------------------------------------------------------- Constants
/**
* String constant for <code>no-cache</code>.
*/
protected static final String NO_CACHE = "no-cache";
/**
* String constant for <code>http://</code>.
*/
public static final String HTTP_PROTOCOL = "http://";
/**
* String constant for <code>HTTP/1.1</code>.
*/
public static final String HTTP_VERSION = "HTTP/1.1";
/**
* String constant for <code>text/xml</code>.
*/
public static final String TEXT_XML = "text/xml";
/**
* String constant for <code>text/xml; charset="UTF-8"</code>.
*/
public static final String TEXT_XML_UTF_8 = "text/xml; charset=\"UTF-8\"";
/**
* The indent to use in the XML response.
*/
public static final String XML_REPONSE_INDENT = " ";
private static final String LOG_CHANNEL =
AbstractWebdavMethod.class.getName();
public static final String LOCK_TOKEN = "opaquelocktoken:";
// public static final String PRINCIPAL =
// "org.apache.slide.webdav.method.principal";
// ----------------------------------------------------- Instance Variables
/**
* Requested Uri.
*/
protected String requestUri;
/**
* Servlet request.
*/
protected HttpServletRequest req;
/**
* Servlet response.
*/
protected HttpServletResponse resp;
/**
* Configuration.
*/
protected WebdavServletConfig config;
/**
* Request body.
*/
protected String requestBody;
/**
* Namespace access token.
*/
protected NamespaceAccessToken token;
/**
* Structure helper.
*/
protected Structure structure;
/**
* Content helper.
*/
protected Content content;
/**
* Security helper.
*/
protected Security security;
/**
* Lock helper.
*/
protected Lock lock;
/** wam
* Search helper.
*/
protected Search search;
/**
* Macro helper.
*/
protected Macro macro;
/**
* Slide token.
*/
protected SlideToken slideToken;
/**
* MD5 message digest provider.
*/
protected static MessageDigest md5Helper;
/**
* The MD5 helper object for this class.
*/
protected static final MD5Encoder md5Encoder = new MD5Encoder();
/**
* The request content (XML) Document.
*/
private Document requestContentDocument = null;
/**
* Indicates if the request content has already been parsed.
*/
private boolean isRequestContentParsed = false;
// -------------------------------------------------- Static Initialization
static {
// Load the MD5 helper used to calculate signatures.
try {
md5Helper = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println(e.toString());
throw new IllegalStateException();
}
}
// ----------------------------------------------------------- Constructors
/**
* Constructor.
*
* @param token the token for accessing the namespace
* @param config configuration of the WebDAV servlet
*/
public AbstractWebdavMethod(NamespaceAccessToken token,
WebdavServletConfig config) {
this.config = config;
this.token = token;
// initialize helpers
structure = token.getStructureHelper();
content = token.getContentHelper();
security = token.getSecurityHelper();
lock = token.getLockHelper();
macro = token.getMacroHelper();
}
// -------------------------------------------- WebdavMethod Implementation
/**
* Exceute method.
*
* @exception WebdavException
*/
public void run(HttpServletRequest req, HttpServletResponse resp)
throws WebdavException {
this.req = req;
this.resp = resp;
this.slideToken = WebdavUtils.getSlideToken(req);
this.requestUri = WebdavUtils.getRelativePath(req, config);
parseHeaders();
boolean transactionIsStarted = false;
try {
parseRequest();
if (methodNeedsTransactionSupport()) {
token.begin();
transactionIsStarted = true;
}
executeRequest();
if (methodNeedsTransactionSupport()) {
token.commit();
transactionIsStarted = false;
}
} catch (WebdavException ex) {
// Ignore the WebDav Exception and assume that the response code
// is already set.
} catch (Exception ex) {
token.getLogger().log(ex,LOG_CHANNEL,Logger.ERROR);
resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
ex.printStackTrace();
throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
} finally {
if (transactionIsStarted && methodNeedsTransactionSupport()) {
// Something went wrong, we are here and the TA is still open
try {
token.rollback();
} catch (Exception e) {
}
}
}
}
// --------------------------------------------------------- Public Methods
/**
* Returns the configuration of the WebdavServlet.
*
* @return WebdavServletConfig
*/
public WebdavServletConfig getConfig() {
return config;
}
/**
* Return an absolute URL (absolute in the HTTP sense) based on a Slide
* path.
*/
public String getFullPath(String path) {
if (path.startsWith("/"))
return WebdavUtils.encodeURL(req.getContextPath() + path);
else
return WebdavUtils.encodeURL(req.getContextPath() + "/" + path);
}
/**
* Returns a Slide path based on an absolute URL
* (absolute in the HTTP sense)
*/
public String getSlidePath(String fullpath) {
// strip off the protocol://host:port part
if (fullpath.indexOf("://") >= 0) {
fullpath=fullpath.substring(fullpath.indexOf("://")+3);
fullpath=fullpath.substring(fullpath.indexOf("/"));
}
// strip off the servlet context path
String contextPath=req.getContextPath();
if (fullpath.startsWith(contextPath)) {
fullpath=fullpath.substring(contextPath.length());
}
return fullpath;
}
// ------------------------------------------------------ Protected Methods
/**
* Return true if the method needs transaction support.
* Return true if the method needs transaction support, e.g.
* the methods put, proppatch would need TA support. The
* methods get, propfind would not need transaction support.
*/
protected boolean methodNeedsTransactionSupport() {
return true;
// this method should return false and e.g. PutMethod should
// overwrite it to true, but PropFind creates a RevisionDescriptors
// on the fly
}
/**
* Read request contents.
*
* @param req Request object handed out by the servlet container
* @return char[] Array of char which contains the body of the request
*/
protected void readRequestContent() {
if (req.getContentLength() == 0)
return;
// TODO : Modify this and make it chunking aware
try {
requestBody = new
String(NodeRevisionContent.readFromStream(req.getInputStream()),
getEncodingString(req.getCharacterEncoding()));
}
catch (Exception e) {
token.getLogger().log(e,LOG_CHANNEL,Logger.ERROR);
}
}
/**
* Translate the encoding string into a proper Java encoding String.
*/
public static String getEncodingString(String httpEncoding) {
String result = httpEncoding;
if (result == null) result = System.getProperty("file.encoding");
if (result.startsWith("\"")) result = result.substring(1, result.length());
if (result.endsWith("\"")) result = result.substring(0, result.length()-1);
return result;
}
/**
* Parse lock token headers.
*/
protected void parseHeaders() {
// Retrieve if header
String ifHeader = req.getHeader("If");
//System.out.println("If header : " + ifHeader);
if (ifHeader == null)
return;
// Parse if header and extract the lock tokens
int pos = ifHeader.indexOf(LOCK_TOKEN);
int endPos = -1;
int offset = LOCK_TOKEN.length();
String lockToken = null;
while (pos != -1) {
endPos = ifHeader.indexOf('>', pos + offset);
if (endPos == -1) {
lockToken = ifHeader;
} else {
lockToken = ifHeader.substring(pos + offset, endPos);
}
//System.out.println("Lock Token found :-" + lockToken + "-");
slideToken.addLockToken(lockToken);
pos = ifHeader.indexOf(LOCK_TOKEN, endPos);
}
}
/**
* Returns the lock token value from the lock token header.
*
* @return String Opaque lock token value
*/
protected String parseLockToken(String lockTokenValue) {
int semi = lockTokenValue.indexOf(":");
String result = null;
try {
result = lockTokenValue.substring(semi + 1,
lockTokenValue.length() - 1);
} catch (Exception e) {
token.getLogger().log(e,LOG_CHANNEL,Logger.ERROR);
}
return result;
}
/**
* Test if a resource given by a path is a collection
*/
protected boolean isCollection(String path) {
return WebdavUtils.isCollection(token, slideToken, path);
}
/**
* Parse WebDAV XML query.
*
* @exception WebdavException
*/
protected abstract void parseRequest()
throws WebdavException;
/**
* Returns the request content (XML) Document.
*
* @return the request content (XML) Document.
*/
protected Document getRequestContent() {
return requestContentDocument;
}
/**
* Parses the request content (XML) Document.
*
* @return the request content (XML) Document.
*
* @throws IOException if an I/O error occurred.
* @throws JDOMException if parsing the document failed.
*/
protected Document parseRequestContent() throws JDOMException, IOException {
if (isRequestContentParsed) {
return requestContentDocument;
}
if (requestBody == null) {
readRequestContent();
if (requestBody == null) {
// there is no request content body, so there's nothing to
// parse
return requestContentDocument;
}
}
try {
requestContentDocument = new SAXBuilder().build(new
StringReader(requestBody));
isRequestContentParsed = true;
}
catch (JDOMException e) {
if (e.getCause() instanceof IOException) {
throw (IOException)e.getCause();
}
else {
throw e;
}
}
return requestContentDocument;
}
/**
* Generate XML response.
*
* @exception WebdavException
*/
protected abstract void executeRequest()
throws WebdavException, IOException;
/**
* Simulate MS IIS5 ?
*
* @return boolean
*/
protected boolean isMsProprietarySupport() {
return (token.getNamespaceConfig().getParameter("ms") != null);
}
/**
* Generate <error> for the given precondition violation.
*
* @param violatedPrecondition the ViolatedPrecondition that describes
* the violated precondition.
*
* @return the <error> for the given precondition violation.
*/
protected Element getPreconditionViolationError(ViolatedPrecondition
violatedPrecondition) {
return getPreconditionViolationError(violatedPrecondition,
NamespaceCache.DEFAULT_NAMESPACE);
}
/**
* Generate <error> for the given precondition violation.
*
* @param violatedPrecondition the ViolatedPrecondition that describes
* the violated precondition.
*
* @return the <error> for the given precondition violation.
*/
protected Element getPreconditionViolationError(ViolatedPrecondition
violatedPrecondition, org.jdom.Namespace namespace) {
Element error = new Element(WebdavConstants.E_ERROR,
namespace);
Element violatedPreconditionElement = new
Element(violatedPrecondition.getPrecondition(),
namespace);
error.addContent(violatedPreconditionElement);
return error;
}
/**
* Sends a precondition vilolation response.
*
* @param pve the ProconditionViolationException that describes the violated
* precondition.
*/
protected void sendPreconditionViolation(PreconditionViolationException pve)
throws IOException {
if (pve != null) {
ViolatedPrecondition violatedPrecondition =
pve.getViolatedPrecondition();
resp.setStatus(violatedPrecondition.getStatusCode());
resp.setContentType(TEXT_XML_UTF_8);
new XMLOutputter(XML_REPONSE_INDENT, true).
output(new
Document(getPreconditionViolationError(pve.getViolatedPrecondition())),
resp.getWriter());
}
}
/**
* Returns the absolute URL of the given <code>uri</code>, e.g.
* if the server is <code>aloha.com:80</code>, context path is
* <code>have</code> and the URI is <code>much/fun</code> the string
* <code>http://aloha:80/have/much/fun</code>.
*
* @param uri the URI for which to return the URL (may be <code>null</code>).
*
* @return the absolute URL.
*/
protected String getAbsoluteURL(String uri) {
StringBuffer buffer = new StringBuffer();
buffer.append(HTTP_PROTOCOL);
buffer.append(req.getServerName());
buffer.append(":");
buffer.append(req.getServerPort());
if ( ! req.getContextPath().startsWith("/") ) {
buffer.append("/");
}
buffer.append(req.getContextPath());
if (uri != null) {
if ( !req.getContextPath().endsWith("/") && !uri.startsWith("/") ) {
buffer.append("/");
}
buffer.append(uri);
}
return buffer.toString();
}
// -------------------------------------------------------- Private Methods
/**
* Get return status based on exception type.
*/
protected int getErrorCode(Throwable ex) {
if ( !(ex instanceof SlideException) ) {
if( ex != null ) ex.printStackTrace();
return WebdavStatus.SC_INTERNAL_SERVER_ERROR;
} else {
return getErrorCode((SlideException)ex);
}
}
/**
* Get return status based on exception type.
*/
protected int getErrorCode(SlideException ex) {
try {
throw ex;
} catch(ObjectNotFoundException e) {
return WebdavStatus.SC_NOT_FOUND;
} catch(ConflictException e) {
return WebdavStatus.SC_CONFLICT;
} catch(ForbiddenException e) {
return WebdavStatus.SC_FORBIDDEN;
} catch(AccessDeniedException e) {
return WebdavStatus.SC_FORBIDDEN;
} catch(ObjectAlreadyExistsException e) {
return WebdavStatus.SC_PRECONDITION_FAILED;
} catch(ServiceAccessException e) {
return getErrorCode((ServiceAccessException)ex);
} catch(ObjectLockedException e) {
return WebdavStatus.SC_LOCKED;
} catch(WebdavException e) {
return e.getStatusCode();
} catch(SlideException e) {
e.printStackTrace();
return WebdavStatus.SC_INTERNAL_SERVER_ERROR;
}
}
/**
* Get return status based on exception type.
*/
protected int getErrorCode(ServiceAccessException ex) {
Throwable cause = ex.getCauseException();
if (cause == null || !(cause instanceof SlideException) ) {
ex.printStackTrace();
if( cause != null ) cause.printStackTrace();
return WebdavStatus.SC_INTERNAL_SERVER_ERROR; // this is the default}
} else {
return getErrorCode((SlideException)cause);
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>