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
3
votes
2 answers

Detecting a new HttpSession

I am new to J2EE and stuck in Session Management. According to the specifications, the isNew() method of HttpSession returns true if there is no previously created sessionID from the client stored on the server. I have run the following code and the…
Tahmid Ali
  • 805
  • 9
  • 29
3
votes
2 answers

How to close a vaadin session but keep http session when browser closed?

I'm developing a vaadin 7 application with user authentication and authorization using jaas with a realm defined in the application server (glassfish). I have this requirements: A user can stay logged in for some time, so that he doesn't need to…
raffael
  • 2,427
  • 4
  • 26
  • 42
3
votes
2 answers

Not getting session attributes in sessionDestroyed() method of HttpSessionListener

I googled and stackoverflowed a lot but cant get this to work. Here is my code. I set a session attribute "topic" in subscribe method but in sessionDestroyed I get it as null. This question on SO seems relevant to mine but doesn't solve the…
aBhijit
  • 5,261
  • 10
  • 36
  • 56
3
votes
1 answer

How to inject request-scoped HttpSessions in sitebricks methods on GAE?

I have the following sitebricks servlet. Foo.get() is accessible as a GET at /foo/bar. I deployed the servlet to GAE. @Service @At("/foo") @Singleton public class Foo { @Get @At("/bar") public Reply bar(Request request, HttpSession…
Ingo
  • 1,552
  • 10
  • 31
3
votes
4 answers

Java Servlet session management, how to create session for login

I am working on a small webapp for fun, using just Java Servlets at the moment. I have two pages, test1 and test2. At the moment I am creating a new session in test1 like this: HttpSession session = request.getSession(true); if…
Casey
  • 12,070
  • 18
  • 71
  • 107
3
votes
2 answers

Overriding Tomcat's method of getting sessionid from the request

Tomcat, per the Java EE standard, allows for requests to specify their existing session ID in two ways: 1) via a cookie; 2) via a "path parameter" (not a regular parameter; a path parameter has the format…
James Corcoran
  • 320
  • 1
  • 5
3
votes
1 answer

Struts 2 session invalidation with setting request session to a new session

In my Struts application once an user login I need to invalidate the current session and create a new session. I invalidate the session with getHttpServletRequest().getSession().invalidate(); And I create a new session as…
Harshana
  • 7,297
  • 25
  • 99
  • 173
3
votes
1 answer

Is it thread unsafe for a @SessionScoped bean to maintain a reference to its HttpSession?

Taking a look at the unrelated portion of this answer to another question, although I understand why the references to request and response are threadunsafe in the question's example, why is it threadunsafe for a SessionScoped bean to reference the…
Patrick Garner
  • 3,201
  • 6
  • 39
  • 58
3
votes
2 answers

How to stop Spring Security from creating a new session?

Scenario I restart the server and browser so there's no session data. I go to www.someurl.com public access page. My controller gets me a session with this HttpSession session=request.getSession(true); I click on a plane anchor link to…
jacekn
  • 1,521
  • 5
  • 29
  • 50
3
votes
1 answer

How to reset the timeout counter of a HTTPSession?

Is there a way to reset the timeout counter of a HTTPSession other than through serving a HTTP request? I'm looking for something like session.resetTimeout();
Twilite
  • 873
  • 9
  • 22
3
votes
6 answers

GWT HTTP Session avaliabilty on client

Is it the only way that making an RPC call in GWT for getting HTTP session attributes ? Is there any way to get them directly in the client side code without making an rpc call ? If browser is maintaining session why we need to go to the server…
user1612220
3
votes
1 answer

HttpSession in Grails Application

In my grails application running on tomcat 7, Somewhere I am invalidating the existing http session (session.invalidate()) and creating a new session (request.getSession(true)). But my this new session is not getting reflected everywhere in grails…
user1180463
  • 247
  • 11
  • 21
2
votes
1 answer

closing http session from other thread

I've implemented a Web application using Spring MVC. The Web application is integrated in a system that has a desktop user interface. I would like to allow users to close Web application's sessions from the destkop GUI. I tried implementing a non…
2
votes
1 answer

Jetty 8 WebSocket and Session

im building a little web app that uses jetty 8 as server and websockets. On client (browser) side: the user opens with his browser my index.html and that opens and establishes a new WebSocket connection with my jetty server. On server side, i have a…
sockeqwe
  • 15,574
  • 24
  • 88
  • 144
2
votes
2 answers

Do session attributes show in URL when handling post redirect in Spring MVC 3?

I am handling forms in Spring MVC and I submitted a form and I am trying to redirect the post request to avoid resubmitting the form with refresh button. But I need a dynamically generated value to be displayed based on the form submission in the…
skip
  • 12,193
  • 32
  • 113
  • 153