diff --git a/src/helma/main/ApplicationManager.java b/src/helma/main/ApplicationManager.java index ad19226a..3e120ef9 100644 --- a/src/helma/main/ApplicationManager.java +++ b/src/helma/main/ApplicationManager.java @@ -281,6 +281,7 @@ public class ApplicationManager implements XmlRpcHandler { String[] staticHome; String xmlrpcHandlerName; String cookieDomain; + String sessionCookieName; String uploadLimit; String debug; boolean encode; @@ -291,25 +292,26 @@ public class ApplicationManager implements XmlRpcHandler { */ AppDescriptor(String name) { appName = name; - mountpoint = getMountpoint(props.getProperty(name+".mountpoint", + mountpoint = getMountpoint(props.getProperty(name + ".mountpoint", appName)); pathPattern = getPathPattern(mountpoint); - staticDir = props.getProperty(name+".static"); - staticMountpoint = getPathPattern(props.getProperty(name+".staticMountpoint", + staticDir = props.getProperty(name + ".static"); + staticMountpoint = getPathPattern(props.getProperty(name + ".staticMountpoint", joinMountpoint(mountpoint, "static"))); staticIndex = "true".equalsIgnoreCase(props.getProperty(name+ ".staticIndex")); - String home = props.getProperty(name+".staticHome"); + String home = props.getProperty(name + ".staticHome"); if (home == null) { staticHome = new String[] {"index.html", "index.htm"}; } else { staticHome = StringUtils.split(home, ","); } - protectedStaticDir = props.getProperty(name+".protectedStatic"); + protectedStaticDir = props.getProperty(name + ".protectedStatic"); - cookieDomain = props.getProperty(name+".cookieDomain"); - uploadLimit = props.getProperty(name+".uploadLimit"); - debug = props.getProperty(name+".debug"); + cookieDomain = props.getProperty(name + ".cookieDomain"); + sessionCookieName = props.getProperty(name + ".sessionCookieName"); + uploadLimit = props.getProperty(name + ".uploadLimit"); + debug = props.getProperty(name + ".debug"); encode = "true".equalsIgnoreCase(props.getProperty(name + ".responseEncoding")); String appDirName = props.getProperty(name + ".appdir"); @@ -454,6 +456,10 @@ public class ApplicationManager implements XmlRpcHandler { holder.setInitParameter("cookieDomain", cookieDomain); } + if (sessionCookieName != null) { + holder.setInitParameter("sessionCookieName", sessionCookieName); + } + if (uploadLimit != null) { holder.setInitParameter("uploadLimit", uploadLimit); } @@ -551,6 +557,5 @@ public class ApplicationManager implements XmlRpcHandler { public String toString() { return "[AppDescriptor "+app+"]"; } - } } diff --git a/src/helma/servlet/AbstractServletClient.java b/src/helma/servlet/AbstractServletClient.java index efffa141..9bb0ba53 100644 --- a/src/helma/servlet/AbstractServletClient.java +++ b/src/helma/servlet/AbstractServletClient.java @@ -48,6 +48,9 @@ public abstract class AbstractServletClient extends HttpServlet { // cookie domain to use String cookieDomain; + // cookie name for session cookies + String sessionCookieName = "HopSession"; + // allow caching of responses boolean caching; @@ -76,6 +79,12 @@ public abstract class AbstractServletClient extends HttpServlet { cookieDomain = cookieDomain.toLowerCase(); } + sessionCookieName = init.getInitParameter("sessionCookieName"); + + if (sessionCookieName == null) { + sessionCookieName = "HopSession"; + } + debug = ("true".equalsIgnoreCase(init.getInitParameter("debug"))); caching = !("false".equalsIgnoreCase(init.getInitParameter("caching"))); } @@ -171,7 +180,7 @@ public abstract class AbstractServletClient extends HttpServlet { String nextKey = reqCookies[i].getName(); String nextPart = reqCookies[i].getValue(); - if ("HopSession".equals(nextKey)) { + if (sessionCookieName.equals(nextKey)) { reqtrans.session = nextPart; } else { reqtrans.set(nextKey, nextPart); @@ -502,7 +511,7 @@ public abstract class AbstractServletClient extends HttpServlet { System.currentTimeMillis(), 36)); reqtrans.session = b.toString(); - Cookie c = new Cookie("HopSession", reqtrans.session); + Cookie c = new Cookie(sessionCookieName, reqtrans.session); c.setPath("/");