I'm trying to integrate my Spring application with the Apache Shiro.
I've done everything based on documentation (Integrating Apache Shiro into
Spring based Applications - http://shiro.apache.org/spring.html) and on
spring sample 1.2.0.
Everything seems to work fine including caching, realms, custom session's id
generators etc. but when it comes to use some spring session beans in a
servlet it simply doesn't work well.
The following example:
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
HttpSession session = request.getSession();
ServletContext sc = session.getServletContext();
WebApplicationContext appContext =
WebApplicationContextUtils.getWebApplicationContext(sc);
SampleSession sampleSession = (SampleSession)
appContext.getBean("sampleSession");
if (sampleSession.getUserName() != null) {
PrintWriter out = response.getWriter();
out.println(sampleSession.getUserName());
} else {
sampleSession.setUserName("lonestarr");
}
}
gives me white page after first request and "lonestarr" after second and...
till now it's ok but after third request I have the white page again :/
I've checked JSESSIONID cookie in my web browser. Every request has got
different JSESSIONIDs in request and response cookies.
When I switch securityManager to http sessionMode it works ok. Every request
has got its JSESSIONID in the request cookie only.
Is it possible to run it in native sessionMode?
-----
-----------------------
Paweł Piątkowski
http://pl.linkedin.com/in/ppiatkowski
--
View this message in context:
http://shiro-user.582556.n2.nabble.com/Getting-Spring-session-bean-in-servlet-using-WebApplicationContext-tp7577601.html
Sent from the Shiro User mailing list archive at Nabble.com.