diff --git a/projects/samskivert/src/java/com/samskivert/servlet/util/CookieUtil.java b/projects/samskivert/src/java/com/samskivert/servlet/util/CookieUtil.java
index 86896913..17a81806 100644
--- a/projects/samskivert/src/java/com/samskivert/servlet/util/CookieUtil.java
+++ b/projects/samskivert/src/java/com/samskivert/servlet/util/CookieUtil.java
@@ -1,5 +1,5 @@
//
-// $Id: CookieUtil.java,v 1.2 2003/10/09 00:48:37 ray Exp $
+// $Id: CookieUtil.java,v 1.3 2003/10/14 02:00:45 mdb Exp $
package com.samskivert.servlet.util;
@@ -49,4 +49,20 @@ public class CookieUtil
c.setMaxAge(0);
rsp.addCookie(c);
}
+
+ /**
+ * Sets the domain of the specified cookie to the server name
+ * associated with the supplied request minus the hostname
+ * (ie. www.samskivert.com becomes
+ * .samskivert.com).
+ */
+ public static void widenDomain (HttpServletRequest req, Cookie cookie)
+ {
+ String domain = req.getServerName();
+ int didx = domain.indexOf(".");
+ if (didx != -1) {
+ domain = domain.substring(didx);
+ }
+ cookie.setDomain(domain);
+ }
}