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
128
votes
4 answers

Spring 3 MVC accessing HttpRequest from controller

I would like to handle request and session attributes myself rather then leave it to spring @SessionAttributes, for login of cookies handling for example. I just cant figure out how could I access the HttpRequest from within a controller, I need a…
JBoy
  • 5,398
  • 13
  • 61
  • 101
63
votes
3 answers

How to invalidate session in JSF 2.0?

What is the best possible way to invalidate session within a JSF 2.0 application? I know JSF itself does not handle session. So far I could find private void reset() { HttpSession session = (HttpSession) FacesContext.getCurrentInstance() …
Niks
  • 4,802
  • 4
  • 36
  • 55
52
votes
3 answers

How do I get a list of all HttpSession objects in a web application?

Let's say I have a running Java-based web application with 0 or more valid HttpSession objects associated with it. I want a way to access the current list of valid HttpSession objects. I was thinking that I could implement an HttpSessionListener and…
Jim Tough
  • 14,843
  • 23
  • 75
  • 96
38
votes
6 answers

Storing Anything in ASP.NET Session Causes 500ms Delays

The Problem: When you use session in an ASP.NET site, it causes dramatic delays (multiples of 500ms) when loading multiple requests at nearly the same time. More Specifically, My Problem Our website uses session exclusively for its SessionId. We use…
bendytree
  • 13,095
  • 11
  • 75
  • 91
38
votes
4 answers

How do you store Java objects in HttpSession?

So I am trying to get a servlet to add a Java object to the session of the user, when this servlet is requested. But after the servlet redirects to the next page and I try to retrieve the object, I get a null object instead. Here is what I do to add…
Tamer
  • 1,724
  • 4
  • 16
  • 15
37
votes
1 answer

How to store session in Spring MVC

What's the best way of storing session related data of a user (like, for example a log of recent actions a user has done) in a Spring MVC (2.5) web application ? Using the classic javax.servlet.http.HttpSession or by specifying scope="session" in…
dakull
  • 719
  • 2
  • 7
  • 14
34
votes
5 answers

How can I manually load a Java session using a JSESSIONID?

I have a servlet which handles a multipart form post. The post is actually being made by a Flash file upload component embedded in the page. In some browsers, the Flash-generated POST doesn't include the JSESSIONID which is making it impossible for…
Robert Campbell
  • 6,848
  • 12
  • 63
  • 93
31
votes
3 answers

How to check if a session is invalid

How to check if a session is invalid or not? There is no method in the API. Is it the same as isNew()? And what is the difference if not?
iddober
  • 1,254
  • 4
  • 23
  • 43
31
votes
3 answers

java.lang.IllegalStateException: getAttribute: Session already invalidated

I am getting the following exception after I invalidate the portletRequest session in my code Aug 27, 2013 7:07:13 AM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet xyzapplication Servlet threw exception…
stallion
  • 1,901
  • 9
  • 33
  • 52
30
votes
4 answers

Accessing ServletContext and HttpSession in @OnMessage of a JSR-356 @ServerEndpoint

I need to get the ServletContext from inside a @ServerEndpoint in order to find Spring ApplicationContext and lookup for a Bean. For the moment my best approach is to bind that bean in the JNDI naming context and lookup it in the Endpoint. Any…
Sombriks
  • 3,370
  • 4
  • 34
  • 54
29
votes
6 answers

Generating a new ASP.NET session in the current HTTPContext

As a result of a penetration test against some of our products in the pipeline, what looked to be at the time an 'easy' problem to fix is turning out to be a toughy. Not that it should of course, I mean why would just generating a brand new session…
Rabid
  • 2,984
  • 2
  • 25
  • 25
26
votes
3 answers

How to inject dependencies into HttpSessionListener, using Spring?

How to inject dependencies into HttpSessionListener, using Spring and without calls, like context.getBean("foo-bar") ?
25
votes
3 answers

Can OWIN middleware use the http session?

I had a little bit of code that I was duplicating for ASP.NET and SignalR and I decided to rewrite it as OWIN middleware to remove this duplication. Once I was running it I noticed that HttpContext.Current.Session was null, and I didn't see any…
user2719430
  • 544
  • 1
  • 4
  • 15
22
votes
2 answers

Where are the Java HttpSession attributes stored?

Are the objects serialized and sent to the user and back on each connection (stored in cookies) ? Or are they stored in the server heap and the cookie is only a very small identifier ? Any information about this topic would be helpful. Thank you
Horatiu Jeflea
  • 7,256
  • 6
  • 38
  • 67
20
votes
3 answers

What is the scope of an HTTP session?

What exactly is the scope of an HTTP session? I've been googling this but can't seem to get a straight answer- A session is supposed to get cleared out "when a user closes their browser", but that's unclear to me- Does that mean closing the browser…
Yarin
  • 173,523
  • 149
  • 402
  • 512
1
2 3
43 44