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 re...@locus.apache.org on 2000/09/02 05:13:35 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/webdav/method CopyMethod.java DeleteMethod.java GetMethod.java HeadMethod.java LockMethod.java MkcolMethod.java MoveMethod.java OptionsMethod.java PostMethod.java PropFindMethod.java PropPatchMethod.java PutMethod.java UnlockMethod.java WebdavMethod.java
remm 00/09/01 20:13:34
Modified: src/share/org/apache/slide/webdav WebdavServlet.java
src/share/org/apache/slide/webdav/method CopyMethod.java
DeleteMethod.java GetMethod.java HeadMethod.java
LockMethod.java MkcolMethod.java MoveMethod.java
OptionsMethod.java PostMethod.java
PropFindMethod.java PropPatchMethod.java
PutMethod.java UnlockMethod.java WebdavMethod.java
Log:
- Small cleanup of the WebDAV servlet code (a lot more is needed)
- Fix for most of the path related problems. The rest is related to
the Destination header path translation in MOVE and COPY
methods.
Revision Changes Path
1.5 +29 -128 jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java
Index: WebdavServlet.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WebdavServlet.java 2000/09/02 02:42:32 1.4
+++ WebdavServlet.java 2000/09/02 03:13:31 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java,v 1.4 2000/09/02 02:42:32 remm Exp $
- * $Revision: 1.4 $
- * $Date: 2000/09/02 02:42:32 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java,v 1.5 2000/09/02 03:13:31 remm Exp $
+ * $Revision: 1.5 $
+ * $Date: 2000/09/02 03:13:31 $
*
* ====================================================================
*
@@ -219,141 +219,42 @@
String methodName = req.getMethod();
- // Bad ... Most probably, we should use getPathInfo()
- // or getPathTranslated() to get a correspondance with the undelying
- // filesystem (which is cool, since we need a PK on ressources)
- // RequestURI contains an absolute path = the complete URL of
- // the object.
- String requestUri = null;
-
- if ((token.getNamespaceConfig().getParameter("standalone") != null)) {
- requestUri = req.getServletPath();
- } else {
- requestUri = req.getPathInfo();
- }
-
- System.out.println(System.currentTimeMillis() + " - "
- + req.getMethod() + " on object " + requestUri);
-
- Principal principal = req.getUserPrincipal();
-
- // Get request body
- char[] buffer = null;
-
WebdavMethod resultMethod = null;
if (methodName.equalsIgnoreCase("GET")) {
- resultMethod = new GetMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("PUT")) {
- resultMethod = new PutMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("POST")) {
- resultMethod = new PostMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("MKCOL")) {
- resultMethod = new MkcolMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("OPTIONS")) {
- resultMethod = new OptionsMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("HEAD")) {
- resultMethod = new HeadMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("COPY")) {
- resultMethod = new CopyMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("MOVE")) {
- resultMethod = new MoveMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("DELETE")) {
- resultMethod = new DeleteMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("PROPFIND")) {
- buffer = readRequestContents(req);
- resultMethod = new PropFindMethod(this, token, requestUri,
- principal, req, resp, buffer);
+ resultMethod = new GetMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("PROPFIND")) {
+ resultMethod = new PropFindMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("HEAD")) {
+ resultMethod = new HeadMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("LOCK")) {
+ resultMethod = new LockMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("UNLOCK")) {
+ resultMethod = new UnlockMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("OPTIONS")) {
+ resultMethod = new OptionsMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("PUT")) {
+ resultMethod = new PutMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("MKCOL")) {
+ resultMethod = new MkcolMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("POST")) {
+ resultMethod = new PostMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("COPY")) {
+ resultMethod = new CopyMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("MOVE")) {
+ resultMethod = new MoveMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("DELETE")) {
+ resultMethod = new DeleteMethod(this, token, req, resp);
+ } else if (methodName.equalsIgnoreCase("PROPPATCH")) {
+ resultMethod = new PropPatchMethod(this, token, req, resp);
}
- if (methodName.equalsIgnoreCase("PROPPATCH")) {
- buffer = readRequestContents(req);
- resultMethod = new PropPatchMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("LOCK")) {
- buffer = readRequestContents(req);
- resultMethod = new LockMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
- if (methodName.equalsIgnoreCase("UNLOCK")) {
- resultMethod = new UnlockMethod(this, token, requestUri,
- principal, req, resp, buffer);
- }
-
if (resultMethod == null) {
throw new WebdavException(WebdavStatus.SC_BAD_REQUEST);
}
-
+
return resultMethod;
- }
-
-
- // ------------------------------------------------------ Protected Methods
-
-
- /**
- * 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 char[] readRequestContents(HttpServletRequest req) {
- int contentLength = req.getContentLength();
-
- char[] result = null;
-
- if (contentLength > 0) {
- try {
- BufferedReader reader = null;
- result = new char[contentLength];
- int position = 0;
- reader = req.getReader();
- while (position < contentLength) {
- int nChar = reader.read(result, position,
- contentLength - position);
- position = position + nChar;
- }
- reader.close();
- } catch (IOException e) {
- System.out.println(e.getMessage());
- } catch (RuntimeException e) {
- e.printStackTrace();
- }
- }
-
- return result;
-
}
1.3 +5 -7 jakarta-slide/src/share/org/apache/slide/webdav/method/CopyMethod.java
Index: CopyMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/CopyMethod.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CopyMethod.java 2000/05/16 05:24:09 1.2
+++ CopyMethod.java 2000/09/02 03:13:32 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/CopyMethod.java,v 1.2 2000/05/16 05:24:09 remm Exp $
- * $Revision: 1.2 $
- * $Date: 2000/05/16 05:24:09 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/CopyMethod.java,v 1.3 2000/09/02 03:13:32 remm Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/09/02 03:13:32 $
*
* ====================================================================
*
@@ -117,10 +117,8 @@
* @param resp HTTP response
*/
public CopyMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
}
1.2 +5 -9 jakarta-slide/src/share/org/apache/slide/webdav/method/DeleteMethod.java
Index: DeleteMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/DeleteMethod.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DeleteMethod.java 2000/05/09 02:47:32 1.1
+++ DeleteMethod.java 2000/09/02 03:13:32 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/DeleteMethod.java,v 1.1 2000/05/09 02:47:32 remm Exp $
- * $Revision: 1.1 $
- * $Date: 2000/05/09 02:47:32 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/DeleteMethod.java,v 1.2 2000/09/02 03:13:32 remm Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/09/02 03:13:32 $
*
* ====================================================================
*
@@ -99,16 +99,12 @@
* DELETE 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
*/
public DeleteMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
}
1.3 +5 -9 jakarta-slide/src/share/org/apache/slide/webdav/method/GetMethod.java
Index: GetMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/GetMethod.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GetMethod.java 2000/07/30 06:30:55 1.2
+++ GetMethod.java 2000/09/02 03:13:32 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/GetMethod.java,v 1.2 2000/07/30 06:30:55 remm Exp $
- * $Revision: 1.2 $
- * $Date: 2000/07/30 06:30:55 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/GetMethod.java,v 1.3 2000/09/02 03:13:32 remm Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/09/02 03:13:32 $
*
* ====================================================================
*
@@ -104,16 +104,12 @@
* GET 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
*/
public GetMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
}
1.2 +5 -9 jakarta-slide/src/share/org/apache/slide/webdav/method/HeadMethod.java
Index: HeadMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/HeadMethod.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HeadMethod.java 2000/05/09 02:47:32 1.1
+++ HeadMethod.java 2000/09/02 03:13:32 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/HeadMethod.java,v 1.1 2000/05/09 02:47:32 remm Exp $
- * $Revision: 1.1 $
- * $Date: 2000/05/09 02:47:32 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/HeadMethod.java,v 1.2 2000/09/02 03:13:32 remm Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/09/02 03:13:32 $
*
* ====================================================================
*
@@ -98,16 +98,12 @@
* HEAD 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
*/
public HeadMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
}
1.6 +6 -7 jakarta-slide/src/share/org/apache/slide/webdav/method/LockMethod.java
Index: LockMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/LockMethod.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LockMethod.java 2000/07/24 23:41:24 1.5
+++ LockMethod.java 2000/09/02 03:13:32 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/LockMethod.java,v 1.5 2000/07/24 23:41:24 remm Exp $
- * $Revision: 1.5 $
- * $Date: 2000/07/24 23:41:24 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/LockMethod.java,v 1.6 2000/09/02 03:13:32 remm Exp $
+ * $Revision: 1.6 $
+ * $Date: 2000/09/02 03:13:32 $
*
* ====================================================================
*
@@ -190,10 +190,9 @@
* @param resp HTTP response
*/
public LockMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
+ readRequestContent();
}
1.3 +5 -9 jakarta-slide/src/share/org/apache/slide/webdav/method/MkcolMethod.java
Index: MkcolMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/MkcolMethod.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MkcolMethod.java 2000/05/11 20:50:53 1.2
+++ MkcolMethod.java 2000/09/02 03:13:32 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/MkcolMethod.java,v 1.2 2000/05/11 20:50:53 remm Exp $
- * $Revision: 1.2 $
- * $Date: 2000/05/11 20:50:53 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/MkcolMethod.java,v 1.3 2000/09/02 03:13:32 remm Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/09/02 03:13:32 $
*
* ====================================================================
*
@@ -109,16 +109,12 @@
* GET 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
*/
public MkcolMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
}
1.3 +5 -9 jakarta-slide/src/share/org/apache/slide/webdav/method/MoveMethod.java
Index: MoveMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/MoveMethod.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MoveMethod.java 2000/05/16 05:24:10 1.2
+++ MoveMethod.java 2000/09/02 03:13:33 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/MoveMethod.java,v 1.2 2000/05/16 05:24:10 remm Exp $
- * $Revision: 1.2 $
- * $Date: 2000/05/16 05:24:10 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/MoveMethod.java,v 1.3 2000/09/02 03:13:33 remm Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/09/02 03:13:33 $
*
* ====================================================================
*
@@ -109,16 +109,12 @@
* MOVE 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
*/
public MoveMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
}
1.3 +5 -7 jakarta-slide/src/share/org/apache/slide/webdav/method/OptionsMethod.java
Index: OptionsMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/OptionsMethod.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OptionsMethod.java 2000/06/15 06:52:07 1.2
+++ OptionsMethod.java 2000/09/02 03:13:33 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/OptionsMethod.java,v 1.2 2000/06/15 06:52:07 remm Exp $
- * $Revision: 1.2 $
- * $Date: 2000/06/15 06:52:07 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/OptionsMethod.java,v 1.3 2000/09/02 03:13:33 remm Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/09/02 03:13:33 $
*
* ====================================================================
*
@@ -87,10 +87,8 @@
public OptionsMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
}
protected void parseRequest()
1.2 +5 -7 jakarta-slide/src/share/org/apache/slide/webdav/method/PostMethod.java
Index: PostMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PostMethod.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PostMethod.java 2000/05/09 02:47:34 1.1
+++ PostMethod.java 2000/09/02 03:13:33 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PostMethod.java,v 1.1 2000/05/09 02:47:34 remm Exp $
- * $Revision: 1.1 $
- * $Date: 2000/05/09 02:47:34 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PostMethod.java,v 1.2 2000/09/02 03:13:33 remm Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/09/02 03:13:33 $
*
* ====================================================================
*
@@ -79,10 +79,8 @@
public PostMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
}
protected void parseRequest()
1.4 +6 -9 jakarta-slide/src/share/org/apache/slide/webdav/method/PropFindMethod.java
Index: PropFindMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PropFindMethod.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PropFindMethod.java 2000/06/15 06:52:07 1.3
+++ PropFindMethod.java 2000/09/02 03:13:33 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PropFindMethod.java,v 1.3 2000/06/15 06:52:07 remm Exp $
- * $Revision: 1.3 $
- * $Date: 2000/06/15 06:52:07 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PropFindMethod.java,v 1.4 2000/09/02 03:13:33 remm Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/09/02 03:13:33 $
*
* ====================================================================
*
@@ -159,16 +159,13 @@
* PROPFIND 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
*/
public PropFindMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
+ readRequestContent();
depth = INFINITY;
propFindType = FIND_ALL_PROP;
1.7 +6 -9 jakarta-slide/src/share/org/apache/slide/webdav/method/PropPatchMethod.java
Index: PropPatchMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PropPatchMethod.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PropPatchMethod.java 2000/07/23 21:56:58 1.6
+++ PropPatchMethod.java 2000/09/02 03:13:33 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PropPatchMethod.java,v 1.6 2000/07/23 21:56:58 remm Exp $
- * $Revision: 1.6 $
- * $Date: 2000/07/23 21:56:58 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PropPatchMethod.java,v 1.7 2000/09/02 03:13:33 remm Exp $
+ * $Revision: 1.7 $
+ * $Date: 2000/09/02 03:13:33 $
*
* ====================================================================
*
@@ -127,16 +127,13 @@
* PROPPATCH 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
*/
public PropPatchMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
+ readRequestContent();
}
1.3 +5 -9 jakarta-slide/src/share/org/apache/slide/webdav/method/PutMethod.java
Index: PutMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PutMethod.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PutMethod.java 2000/07/30 05:02:11 1.2
+++ PutMethod.java 2000/09/02 03:13:33 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PutMethod.java,v 1.2 2000/07/30 05:02:11 remm Exp $
- * $Revision: 1.2 $
- * $Date: 2000/07/30 05:02:11 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/PutMethod.java,v 1.3 2000/09/02 03:13:33 remm Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/09/02 03:13:33 $
*
* ====================================================================
*
@@ -109,16 +109,12 @@
* PUT 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
*/
public PutMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
}
1.2 +5 -9 jakarta-slide/src/share/org/apache/slide/webdav/method/UnlockMethod.java
Index: UnlockMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/UnlockMethod.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UnlockMethod.java 2000/05/09 02:47:35 1.1
+++ UnlockMethod.java 2000/09/02 03:13:33 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/UnlockMethod.java,v 1.1 2000/05/09 02:47:35 remm Exp $
- * $Revision: 1.1 $
- * $Date: 2000/05/09 02:47:35 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/UnlockMethod.java,v 1.2 2000/09/02 03:13:33 remm Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/09/02 03:13:33 $
*
* ====================================================================
*
@@ -104,16 +104,12 @@
* UNLOCK 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
*/
public UnlockMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
- super(servlet, token, requestUri, principal, req, resp, requestBody);
+ HttpServletRequest req, HttpServletResponse resp) {
+ super(servlet, token, req, resp);
}
1.4 +65 -9 jakarta-slide/src/share/org/apache/slide/webdav/method/WebdavMethod.java
Index: WebdavMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/WebdavMethod.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WebdavMethod.java 2000/06/15 06:52:08 1.3
+++ WebdavMethod.java 2000/09/02 03:13:33 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/WebdavMethod.java,v 1.3 2000/06/15 06:52:08 remm Exp $
- * $Revision: 1.3 $
- * $Date: 2000/06/15 06:52:08 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/method/WebdavMethod.java,v 1.4 2000/09/02 03:13:33 remm Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/09/02 03:13:33 $
*
* ====================================================================
*
@@ -192,9 +192,7 @@
* Method constructor.
*/
public WebdavMethod(GenericServlet servlet, NamespaceAccessToken token,
- String requestUri, Principal principal,
- HttpServletRequest req, HttpServletResponse resp,
- char[] requestBody) {
+ HttpServletRequest req, HttpServletResponse resp) {
if (documentBuilder == null) {
try {
@@ -205,13 +203,11 @@
}
}
- this.requestUri = requestUri;
- this.principal = principal;
+ this.principal = req.getUserPrincipal();
this.req = req;
this.resp = resp;
this.servlet = servlet;
this.context = servlet.getServletContext();
- this.requestBody = requestBody;
this.token = token;
this.structure = token.getStructureHelper();
@@ -225,6 +221,11 @@
this.credToken = new CredentialsToken("");
}
+ this.requestUri = getRelativePath(req);
+
+ System.out.println(System.currentTimeMillis() + " - "
+ + req.getMethod() + " on object " + requestUri);
+
}
@@ -251,6 +252,61 @@
// ------------------------------------------------------ Protected Methods
+
+
+ /**
+ * Return the relative path associated with this servlet.
+ *
+ * @param request The servlet request we are processing
+ */
+ protected String getRelativePath(HttpServletRequest request) {
+
+ String result = request.getPathInfo();
+ if (result == null) {
+ result = request.getServletPath();
+ }
+ if ((result == null) || (result.equals(""))) {
+ result = "/";
+ }
+ return result;
+
+ }
+
+
+ /**
+ * 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() {
+
+ // TODO : Modify this and make it chunking aware
+
+ int contentLength = req.getContentLength();
+
+ char[] result = null;
+
+ if (contentLength > 0) {
+ try {
+ BufferedReader reader = null;
+ requestBody = new char[contentLength];
+ int position = 0;
+ reader = req.getReader();
+ while (position < contentLength) {
+ int nChar = reader.read(requestBody, position,
+ contentLength - position);
+ position = position + nChar;
+ }
+ reader.close();
+ } catch (IOException e) {
+ System.out.println(e.getMessage());
+ } catch (RuntimeException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
/**