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