Make session cookie name configurable via sessionCookieName in apps.properties
(merge from helma_1_4)
This commit is contained in:
parent
bcf5542565
commit
344c0da36e
2 changed files with 25 additions and 11 deletions
|
@ -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+"]";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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("/");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue