diff --git a/api/src/main/java/org/sakaiproject/util/RequestFilter.java b/api/src/main/java/org/sakaiproject/util/RequestFilter.java index 1be1859..545a4cc 100644 --- a/api/src/main/java/org/sakaiproject/util/RequestFilter.java +++ b/api/src/main/java/org/sakaiproject/util/RequestFilter.java @@ -164,6 +164,12 @@ public class RequestFilter implements Filter */ public static final String CONFIG_UPLOAD_DIR = "upload.dir"; + /** + * Config parameter to control if we should setup a cookie if one doesn't exist. Useful if you don't want DAV to generate + * new cookies. Default true. + */ + public static final String CONFIG_SET_COOKIE = "set.cookie"; + /** System property to control the temporary directory in which to store file uploads. */ public static final String SYSTEM_UPLOAD_DIR = "sakai.content.upload.dir"; @@ -276,8 +282,10 @@ public class RequestFilter implements Filter protected boolean m_cookieHttpOnly = true; protected String m_UACompatible = null; - - + + /** Should we attempt to set a new cookie if we create a new session. */ + protected boolean m_setCookie = true; + /** * Wraps a request object so we can override some standard behavior. */ @@ -663,7 +671,7 @@ public class RequestFilter implements Filter } // Output client cookie if requested to do so - if (s != null && req.getAttribute(ATTR_SET_COOKIE) != null) { + if (s != null && m_setCookie && req.getAttribute(ATTR_SET_COOKIE) != null) { // check for existing cookie String suffix = getCookieSuffix(); @@ -837,6 +845,11 @@ public class RequestFilter implements Filter m_uploadEnabled = Boolean.valueOf(filterConfig.getInitParameter(CONFIG_UPLOAD_ENABLED)).booleanValue(); } + if (filterConfig.getInitParameter(CONFIG_SET_COOKIE) != null) + { + m_setCookie = Boolean.valueOf(filterConfig.getInitParameter(CONFIG_SET_COOKIE)).booleanValue(); + } + // get the maximum allowed upload size from the system property - use if not overriden, and also use as the ceiling if that // is not defined. if (System.getProperty(SYSTEM_UPLOAD_MAX) != null) @@ -1283,7 +1296,7 @@ public class RequestFilter implements Filter // if we have a session and had no cookie, // or the cookie was to another session id, set the cookie - if ((s != null) && allowSetCookieEarly) + if ((s != null) && m_setCookie && allowSetCookieEarly) { // the cookie value we need to use sessionId = s.getId() + DOT + suffix;