java


sessionCookiePath attribute doesn't work on my tomcat7 server


I deployed two web applications on my tomcat server, i hope they can share session data between each other. so i add an attribute sessionCookiePath="/" into the Context tag in context.xml file. but after restart the server, it still set the cookie with application path, such as "Set-Cookie: JSESSIONID=7200fce5-8aee-4d95-b4d8-4ab586dba152; Path=/webapp1; HttpOnly"!
The version of tomcat server is 7.047.
Here's the content of my context.xml
<Context sessionCookiePath="/"><WatchedResource>WEB-INF/web.xml</WatchedResource></Context>
And here's server.xml
<Server port="8005" shutdown="SHUTDOWN"><Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
After that, i tried to fix this problem with web.xml in the applicatoin, added cookie-config tag, but it still doesn't work.
this is web.xml
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>imeapcore</display-name><session-config>
<cookie-config>
<path>/</path>
</cookie-config></session-config>
<listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>nutz</filter-name>
<filter-class>org.nutz.mvc.NutFilter</filter-class>
<init-param>
<param-name>modules</param-name>
<param-value>com.imeap.webservice.MainModule</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>nutz</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
I got it.
I used shiro manage session info instead of tomcat itself, so "sessionCookiePath" attribute was omitted. This should be set in shiro.ini, such as:
sessionIdCookie=org.apache.shiro.web.servlet.SimpleCookie
sessionIdCookie.name=sid
sessionIdCookie.path=/

Related Links

calling different class objects based on value of string [closed]
Default Comparator for LevelDB
What's the difference between the methods findAttribute() and getAttribute() in servlet?
Has viewing an EventSource in Real-Time in Chrome using the browser been deprecated?
GSON equivalent for #JsonIgnoreProperties in Jackson
I tried to read string from file and store it in Excel sheet
List of timestamps overrides the previous timestamp
Create an useful and scalable class for SQLite Android
Java: Re-running user input in program after invalid entry (loop?)
Do arrow keys don't work in terminal emulation vai ssh
draw method animation to another class
Usage of WiFi-Direct in Game Development (Android)
From JSON to XML and back in Java
Flushing in the repositories
How to read from files with Files.lines(…).forEach(…)?
return an array from a function in java android

Categories

HOME
bluetooth
mediawiki
pycharm
stock
graphql
echarts
azure-storage-tables
windows-10-universal
google-cloud-ml
moonmail
ibm-odm
quickfix
systemc
libtiff
text-rendering
nas
mps
css-animations
microsoft-r
restful-authentication
lcd
autosys
smb
facebook-apps
c++-amp
data-manipulation
catel
google-qpx-express-api
textmate
cloud-code
suricata
greenrobot-eventbus
ensembles
galen
pdf-reactor
apple-news
jsch
network-flow
upstart
react-scripts
elgg
r-forge
pdfclown
watchconnectivity
angular-strap
ado.net-entity-data-model
persist
two-factor-authentication
wapiti
thredds
computer-algebra-systems
operation
processmodel
iiviewdeckcontroller
pretty-print
clipperlib
code-access-security
bitcoinj
google-reader
elliptic-curve
jquery-layout
phpthumb
htmlcleaner
doskey
transcoding
mbr
intentservice
imdbpy
mysqltuner
listings
pushbackinputstream
clipper
angularjs-controller
pvrtc
dmoz
sublist
work-stealing
fireworks
f#-powerpack
horizontal-accordion
locationlistener
oncheckedchanged
gamequery
wise
routedevent
forums
nsviewanimation
zend-tool
sustainable-pace
zend-decorators
data-acquisition
document-conversion

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile