Author: markt
Date: Mon Jul 30 16:28:44 2007
New Revision: 561185
URL: http://svn.apache.org/viewvc?view=rev&rev=561185
Log:
Fix WebDAV for MS clients.
Fix error message when there is no request content
Ported from TC5
Modified:
tomcat/container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt
tomcat/container/branches/tc4.1.x/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java
Modified: tomcat/container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt
URL:
http://svn.apache.org/viewvc/tomcat/container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt?view=diff&rev=561185&r1=561184&r2=561185
==============================================================================
--- tomcat/container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt (original)
+++ tomcat/container/branches/tc4.1.x/RELEASE-NOTES-4.1.txt Mon Jul 30 16:28:44
2007
@@ -1678,6 +1678,9 @@
constraint that is defined with no roles and no associated
login-config is specified.
+[4.1.37] WebDAV
+ Fix issues with MS clients.
+
----------------
Coyote Bug Fixes:
Modified:
tomcat/container/branches/tc4.1.x/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java
URL:
http://svn.apache.org/viewvc/tomcat/container/branches/tc4.1.x/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java?view=diff&rev=561185&r1=561184&r2=561185
==============================================================================
---
tomcat/container/branches/tc4.1.x/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java
(original)
+++
tomcat/container/branches/tc4.1.x/catalina/src/share/org/apache/catalina/servlets/WebdavServlet.java
Mon Jul 30 16:28:44 2007
@@ -288,6 +288,35 @@
/**
+ * Override the DefaultServlet implementation and only use the PathInfo. If
+ * the ServletPath is non-null, it will be because the WebDAV servlet has
+ * been mapped to a url other than /* to configure editing at different url
+ * than normal viewing.
+ *
+ * @param request The servlet request we are processing
+ */
+ protected String getRelativePath(HttpServletRequest request) {
+
+ // Are we being processed by a RequestDispatcher.include()?
+ if (request.getAttribute("javax.servlet.include.request_uri")!=null) {
+ String result = (String)
+ request.getAttribute("javax.servlet.include.path_info");
+ if ((result == null) || (result.equals("")))
+ result = "/";
+ return (result);
+ }
+
+ // No, extract the desired path directly from the request
+ String result = request.getPathInfo();
+ if ((result == null) || (result.equals(""))) {
+ result = "/";
+ }
+ return (result);
+
+ }
+
+
+ /**
* OPTIONS Method.
*/
protected void doOptions(HttpServletRequest req, HttpServletResponse resp)
@@ -369,38 +398,40 @@
Node propNode = null;
- DocumentBuilder documentBuilder = getDocumentBuilder();
-
- try {
- Document document = documentBuilder.parse
- (new InputSource(req.getInputStream()));
-
- // Get the root element of the document
- Element rootElement = document.getDocumentElement();
- NodeList childList = rootElement.getChildNodes();
-
- for (int i=0; i < childList.getLength(); i++) {
- Node currentNode = childList.item(i);
- switch (currentNode.getNodeType()) {
- case Node.TEXT_NODE:
- break;
- case Node.ELEMENT_NODE:
- if (currentNode.getNodeName().endsWith("prop")) {
- type = FIND_BY_PROPERTY;
- propNode = currentNode;
- }
- if (currentNode.getNodeName().endsWith("propname")) {
- type = FIND_PROPERTY_NAMES;
- }
- if (currentNode.getNodeName().endsWith("allprop")) {
- type = FIND_ALL_PROP;
+ if (req.getInputStream().available() > 0) {
+ DocumentBuilder documentBuilder = getDocumentBuilder();
+
+ try {
+ Document document = documentBuilder.parse
+ (new InputSource(req.getInputStream()));
+
+ // Get the root element of the document
+ Element rootElement = document.getDocumentElement();
+ NodeList childList = rootElement.getChildNodes();
+
+ for (int i=0; i < childList.getLength(); i++) {
+ Node currentNode = childList.item(i);
+ switch (currentNode.getNodeType()) {
+ case Node.TEXT_NODE:
+ break;
+ case Node.ELEMENT_NODE:
+ if (currentNode.getNodeName().endsWith("prop")) {
+ type = FIND_BY_PROPERTY;
+ propNode = currentNode;
+ }
+ if (currentNode.getNodeName().endsWith("propname")) {
+ type = FIND_PROPERTY_NAMES;
+ }
+ if (currentNode.getNodeName().endsWith("allprop")) {
+ type = FIND_ALL_PROP;
+ }
+ break;
}
- break;
}
+ } catch(Exception e) {
+ // Something went wrong - use the defaults.
+ // TODO : Enhance that !
}
- } catch(Exception e) {
- // Most likely there was no content : we use the defaults.
- // TODO : Enhance that !
}
if (type == FIND_BY_PROPERTY) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]