I have one application that processes multiple subdomains, such as
- sub1.domain.com
- sub2.domain.com
- www.domain.com
- domain.com
The user can switch between these subdomains when using the application. When this happens, the session is not split between these subdomains. I use tomcat as a server for development and production.
I try to create shared sessions in development first. Upon reading, it turned out that the way to achieve this in tomcat is:
<Context sessionCookiePath="/" sessionCookieDomain=".domain.com">
Is there a way to install this on tomcat in a development environment?
I tried the code below in _Events.groovy, without success:
eventConfigureTomcat = {tomcat ->
def context = tomcat.addContext("","/")
context.setSessionCookieDomain(".domain.com")
context.setSessionCookiePath("/")
}
I get java.lang.IllegalArgumentException: addChild: child name 'error is not unique
, ( , getContext):
eventConfigureTomcat = {tomcat ->
def context = tomcat.getContext("") //This function does not exist
context.setSessionCookieDomain(".domain.com")
context.setSessionCookiePath("/")
}
, , ?
.