Author: remy.maucherat(a)jboss.com
Date: 2007-12-03 06:19:12 -0500 (Mon, 03 Dec 2007)
New Revision: 357
Modified:
trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
trunk/java/org/apache/catalina/core/StandardWrapper.java
trunk/java/org/apache/catalina/servlets/WebdavServlet.java
trunk/webapps/docs/changelog.xml
Log:
- Port 3 patches, the most important being a fix for form with conditional headers.
Modified: trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
===================================================================
--- trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java 2007-11-29
16:10:02 UTC (rev 356)
+++ trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java 2007-12-03
11:19:12 UTC (rev 357)
@@ -402,12 +402,20 @@
MimeHeaders rmh = request.getCoyoteRequest().getMimeHeaders();
rmh.recycle();
+ boolean cachable = "GET".equalsIgnoreCase(saved.getMethod()) ||
+ "HEAD".equalsIgnoreCase(saved.getMethod());
Iterator names = saved.getHeaderNames();
while (names.hasNext()) {
String name = (String) names.next();
- Iterator values = saved.getHeaderValues(name);
- while (values.hasNext()) {
- rmh.addValue(name).setString( (String)values.next() );
+ // The browser isn't expecting this conditional response now.
+ // Assuming that it can quietly recover from an unexpected 412.
+ // BZ 43687
+ if(!("If-Modified-Since".equalsIgnoreCase(name) ||
+ (cachable && "If-None-Match".equalsIgnoreCase(name))))
{
+ Iterator values = saved.getHeaderValues(name);
+ while (values.hasNext()) {
+ rmh.addValue(name).setString( (String)values.next() );
+ }
}
}
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2007-11-29 16:10:02 UTC (rev
356)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2007-12-03 11:19:12 UTC (rev
357)
@@ -1628,7 +1628,7 @@
broadcaster.sendNotification(notification);
}
} catch( Exception ex ) {
- log.info("Error registering servlet with jmx " + this);
+ log.info("Error registering servlet with jmx " + this, ex);
}
if (isJspServlet) {
@@ -1643,7 +1643,7 @@
.registerComponent(instance, jspMonitorON, null);
} catch( Exception ex ) {
log.info("Error registering JSP monitoring with jmx " +
- instance);
+ instance, ex);
}
}
}
Modified: trunk/java/org/apache/catalina/servlets/WebdavServlet.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/WebdavServlet.java 2007-11-29 16:10:02 UTC
(rev 356)
+++ trunk/java/org/apache/catalina/servlets/WebdavServlet.java 2007-12-03 11:19:12 UTC
(rev 357)
@@ -66,10 +66,52 @@
/**
* Servlet which adds support for WebDAV level 2. All the basic HTTP requests
- * are handled by the DefaultServlet.
+ * are handled by the DefaultServlet. The WebDAVServlet must not be used as the
+ * default servlet (ie mapped to '/') as it will not work in this configuration.
+ * To enable WebDAV for a context add the following to web.xml:<br/><code>
+ * <servlet><br/>
+ * <servlet-name>webdav</servlet-name><br/>
+ *
<servlet-class>org.apache.catalina.servlets.WebdavServlet</servlet-class><br/>
+ * <init-param><br/>
+ * <param-name>debug</param-name><br/>
+ * <param-value>0</param-value><br/>
+ * </init-param><br/>
+ * <init-param><br/>
+ * <param-name>listings</param-name><br/>
+ * <param-value>true</param-value><br/>
+ * </init-param><br/>
+ * </servlet><br/>
+ * <servlet-mapping><br/>
+ * <servlet-name>webdav</servlet-name><br/>
+ * <url-pattern>/*</url-pattern><br/>
+ * </servlet-mapping>
+ * </code>
+ * <p/>
+ * This will enable read only access. To enable read-write access add:<br/>
+ * <code>
+ * <init-param><br/>
+ * <param-name>readonly</param-name><br/>
+ * <param-value>false</param-value><br/>
+ * </init-param><br/>
+ * </code>
+ * <p/>
+ * To make the content editable via a different URL, using the following
+ * mapping:<br/>
+ * <code>
+ * <servlet-mapping><br/>
+ * <servlet-name>webdav</servlet-name><br/>
+ * <url-pattern>/webdavedit/*</url-pattern><br/>
+ * </servlet-mapping>
+ * </code>
+ * <p/>
+ * Don't forget to secure access appropriately to the editing URLs. With this
+ * configuration the context will be accessible to normal users as before. Those
+ * users with the necessary access will be able to edit content available via
+ *
http://host:port/context/content using
+ *
http://host:port/context/webdavedit/content
*
* @author Remy Maucherat
- * @version $Revision: 561186 $ $Date: 2007-07-31 01:37:47 +0200 (mar., 31 juil. 2007) $
+ * @version $Revision: 600268 $ $Date: 2007-12-02 12:09:55 +0100 (Sun, 02 Dec 2007) $
*/
public class WebdavServlet
@@ -1692,6 +1734,9 @@
}
+ // Copy was successful
+ resp.setStatus(WebdavStatus.SC_CREATED);
+
// Removing any lock-null resource which would be present at
// the destination path
lockNullResources.remove(destinationPath);
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2007-11-29 16:10:02 UTC (rev 356)
+++ trunk/webapps/docs/changelog.xml 2007-12-03 11:19:12 UTC (rev 357)
@@ -80,6 +80,22 @@
<fix>
Improve error codes returned when no host or no context is matched. (remm)
</fix>
+ <fix>
+ <bug>43706</bug>: WebDAV copy/move now returns 201 on success. Based
on
+ a patch by Panagiotis Astithas. (markt)
+ </fix>
+ <fix>
+ <bug>43887</bug>: Make error messages much more helpful when illegal
+ Servlet names are used. Based on a patch provided by Mike Baranczak.
+ (markt)
+ </fix>
+ <update>
+ Improve the webDAV Servlet Javadocs to make clear that the WebDAV
+ Servlet can not be used as the default servlet. (markt)
+ </update>
+ <fix><bug>43687</bug> Remove conditional headers on Form Auth
replay,
+ since the UA (esp. FireFox) isn't expecting it.
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">