Questions tagged [httpsession]

An Java interface used by the servlet container to create a session between an HTTP client and an HTTP server.

An Java interface used by the servlet container to create a session between an HTTP client and an HTTP server. The session object has an expiration time which allows the container to invalidate the session after that specified time of the user inactivity. It is active while the user making requests, across more than one connection or page and remains active after the user exit application and stay active until it's expired. The server persists the session object for the user between restarts. While it's valid the session interface allows the application to bind objects to it and access then from different requests of the same user. A session usually corresponds to one user, who may visit a site many times. The server can maintain a session in many ways such as using cookies or rewriting URLs.

Details from the API docs:

Tutorials:

655 questions
2
votes
1 answer

distinguish between session timeout and session explicit (programmatic) invalidation

I have an HttpSessionListener. Is there a way, inside its sessionDestroyed method to distinguish between the following cases: the session was destroyed because the session-timeout configured in the web.xml was exceeded the session was destroyed…
Marcus Junius Brutus
  • 26,087
  • 41
  • 189
  • 331
2
votes
1 answer

How to get serialized tomcat HttpSession to repopulate spring SessionRegistry

I do the following: login to my spring application (e.g. as user 'admin') stop tomcat Now I see the session being serialized into sessions.ser file I restart tomcat the sessions.ser file disappears (I guess it is being deserialized during server…
SebastianRiemer
  • 1,495
  • 2
  • 20
  • 33
2
votes
1 answer

java.lang.IllegalStateException: No thread-bound request found:

I'm running scheduler in spring mvc service method. Here I'm trying to get data from session without httpRequest. I searched some ways to do so, and i got some ideas adding org.springframework.web.context.request.RequestContextListener to web.xml…
sy choi
  • 43
  • 1
  • 6
2
votes
2 answers

How to Fix Non-serializable objects should not be stored in "HttpSession" objects (squid:S2441)

I'm getting the Sonarqube defect Non-serializable objects should not be stored in "HttpSession" objects (squid:S2441) for the saving in Httpsession, code: public static HttpSession setSessionAttribute(final HttpSession session, final String…
MPPNBD
  • 1,566
  • 4
  • 20
  • 36
2
votes
0 answers

Java Session Management in multiple tabs of same browser

I want to allow multiple user login in my application and need to track it through HttpSession such that i can manage previously logged in user session even after new session for new user will be created. I am aware, this can be achieved using…
2
votes
2 answers

is it good to store a non-serializable object as an HttpSession attribute?

I am using fortify web app, it's pointing an issue for the following code as the method addToSession() in stores a non-serializable object as an HttpSession attribute, which can damage application reliability. public class DataGlob { String…
Sameer
  • 41
  • 3
  • 7
2
votes
1 answer

Domain object stored in session is becoming detached

I have a Grails application (2.5.4) deployed on production which receives a large amounts of traffic. We are getting intermittent LazyInitializationException exceptions when trying to access fields from domain objects that are stored in the…
DeaIss
  • 2,525
  • 7
  • 27
  • 37
2
votes
1 answer

Forcing creation of HttpContext.Current.Session in .NET

I'm working on an application that uses .NET's StaticFileHandler to serve up dynamically generated content... There is also another part of our application that uses the current HttpSession to store user-specific data. Since the StaticFileHandler is…
Mike Ruhlin
  • 3,546
  • 2
  • 21
  • 31
2
votes
1 answer

HttpSession in tomcat

We are using the tomcat for our web application and for session management we use HttpSession in Javax.servlet.http.HttpSession This is how We set the session Id and few user attributes in HTTPSession HTTPSession session =…
Harry
  • 3,072
  • 6
  • 43
  • 100
2
votes
1 answer

How to propagate CDI session beans from HTTP session to WebSocket session?

I googled a lot for this problem before posting this question and Accessing HttpSession from HttpServletRequest in a Web Socket @ServerEndpoint is one of the best Questions/Answers I was able to found, but it appears to not solve my problem. I was…
Ivano85
  • 98
  • 1
  • 11
2
votes
2 answers

WebSocket closed before HttpSessionListener.sessionDestroyed is called

I am implementing a Spring Boot + WebSocket + SockJS application and have a doubt about how to handle the HTTP session/ Websocket relation. Basically I would like to be able to inform the user that his session has been invalidated (because of a…
2
votes
1 answer

How Do I Keep HttpSessions Alive in Tomcat?

I'm having a bit of trouble with Session timeouts in my Tomcat served web application. From reading over Tomcat's documentation, sessions expire after a time which can be configured in the web.xml file.
2
votes
2 answers

Get session creation time in Grails + Apache Shiro

There's this text Last seen: field in my application that shows for how long the current user is logged on the system (e.g. 5 seconds ago, 4 hours ago, 3 days ago, etc.). Now for me to do this, I need to determine either: the time Apache Shiro…
Gideon
  • 1,469
  • 2
  • 26
  • 57
2
votes
1 answer

GAE: Way to get reference to an HttpSession from its ID?

Under Google App Engine any object that you want to store in a HttpSession has to implement Serializable, and all of its fields have to be serializable, because an instance running in GAE might be migrated from one JVM to another. This means that…
Matthew Cline
  • 2,312
  • 1
  • 19
  • 36
2
votes
2 answers

SessionAware design in Struts 2

I have been working with Struts 2 for a long time. In case of implementing SessionAware interface to our action class we will get SessionMap but not HttpSession object. In case of ServletRequestAware and ServletResposeAware we get HttpServletRequest…
Jagadeesh
  • 862
  • 7
  • 23