httpsession « Session « JSP-Servlet Q&A

1. How is Jmock used with HttpSession and HttpServletRequest

I am new to jmock and trying to mock an HttpSession. I am getting: java.lang.AssertionError: unexpected invocation: httpServletRequest.getSession() no expectations specified: did you... - forget to start an expectation with a cardinality clause? ...

2. Is it advisable to cast HttpSession as ClientSession in Java? What is the best practice?

The question is self explanatory I guess. This is what I am doing:

Student student = Student.findStudent(s.getRegNumber(), (ClientSession)httpSesn);
findStudent() method returns me an object of the Student class. As you can see I ...

3. How to obtain an HttpSession Object from SessionID?

I want to invalidate sessions of users based on some Event. I store their sessionID, how to get their HttpSession from this ID? The HttpSessionContext class is deprecated with no replacement.

4. Can a HttpSession object be migraed from one VM to anoher VM?

Hi Can session object be migrated from one VM to another VM or It passivated in one VM and activated in other VM? How?

5. too much information in HttpSession

Hi what do you think about this problem? We do have too much information in HttpSession, because much information is computed and a few large graph of objects are needed to store ...

6. Amount of data stored in session

What technique should we use to make the httpsession object not loaded heavily with data. Example : Request 1 ---- > httpSession loaded with an arraylist of 50,000 different ...

7. How can i load Java HttpSession from JSESSIONID?

I want to get Java HttpSession by JSESSIONID. Is it possible? If yes, how?

8. Storing a JDBC Connection in HttpSession

I've recently inherited some code, within which I've found a JDBC connection being initialized in a filter and added the the HttpSession for each user. That connection is then reused ...

9. How to access the session from a Java class

I need to write a small Java class that will enable me to add to and read from the current user session. Everything I see refers to Servlets but I'd ideally like ...

10. 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 ...

11. Java Servlets and HttpSessions

Very basic question. I have a portal containing several servlets, one of which takes care of logging in (but only as an admin). How do I use HttpSessions between Servlets to know ...

12. Servlet JApplet: HttpSession

This sounds like a simple question but I can't find good information. I'm writing a small JApplet that will be sending some info to a server servlet I want to be able to ...

13. Serializing a HttpSession object

I tried to serialize the HttpSession object and got the following exeption org.apache.catalina.session.StandardSessionFacade
at com.tps.Session.saveSession(
at org.apache.jsp.setSession_jsp._jspService(
at org.apache.jasper.runtime.HttpJspBase.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.jasper.servlet.JspServletWrapper.service(
at org.apache.jasper.servlet.JspServlet.serviceJspFile(
at org.apache.jasper.servlet.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.Applic 

14. Jetty http session is always null (Embedded Container, ServletHolder)

I am trying to implement a simple servlet which uses a HTTP session in an embedded jetty (7.3.0 v20110203) container. To start jetty I use the following code:

Server server = new Server(12043);
ServletContextHandler ...

15. 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 ...

16. java httpsession is valid?

i'm using java servlet in tomcat. i save in a hash table the username and the httpsession with the attribute usrname i would like to know if there is a way to know ...

17. Retrieve Session from FacesContext in a Servlet

The scenario is :

My JSF application invokes an external application with some JSON data. The external app processes the data and returns the request back to my JSF app's servlet along ...

18. Can I delete a HttpSession manually in a servlet?

I took a JSP class and we learnt that we should always remove all the attributes of the HttpSession before we use it. So one of my classmate asked - "How ...

19. HttpSession Dilemma

Hi, There are some disadvantages in using HttpSession : 1. You need to keep your page in sinc with session info. Back button could easly blow up you web app. 2. scalability. A lot of users with session information will eat memory on a server. 3. If user does in IE File-New-Window, or opens multiple instances of NS, this windows will ...

20. Getting a new HttpSession when clicked on a link with target set as "_blank"

I have a page where in I'm using link as follows:

When the link is clicked, I'm getting a new session. But if the target attribute is removed I 'm getting the desired page with same session.

Can't figure out what is the problem. Please help. Thanks in advance.


21. HttpSession = total confusion

22. HttpSession concept

Do mean windows of the same browser program or windows of two different browser programs? If you open more than one window in IE they all share the same session. However if you start Netscape and hit the same URL, you'll get another session. I'm not sure if Netscape shares the same session or not between its own multiple windows. I ...

23. HttpSession question?

24. serializable object in httpsession

25. HttpSession

26. HttpSession in JSP

27. HttpSession

28. Objects in HttpSession

When I employ such a mechanism I usually use a Factory class that uses lazy-loading and caching. All access to the object is done through the factory API, so the calling code doesn't need to be concerned with the details of caching or anything else. The factory class is responsible for loading the object and maintaining the cache, including deciding when ...

29. Javascript Object in HttpSession

31. Servlets HttpSession

33. HttpSession with two different copies

Hi, GOAL: Is to get the same session attribute value in to two different variables (list1 and list2) and then modify one variable (list1) with the user input through mutiple screens and then if the user wants to cancel his input entry, then use the unmodified variable(list2) I got a list of DTO which is stored in session. I am getting ...

34. Jetty + Servlet + HttpSession: how?

My simple code to fire up Jetty and simple Servlet for that: package com.freakz.hokan.newnet.webui; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import; import org.eclipse.jetty.server.session.SessionHandler; import org.eclipse.jetty.servlet.ServletHandler; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import; /** * Created by IntelliJ IDEA. * User: petria * Date: Feb 22, 2010 * Time: 9:30:10 PM */ public class ...

35. HttpSession in JSP

38. HttpSession became null

i have a Jsp which renders tables dynamically through display tags. The table acts as a tree structure. Each tree has a node which when clicked, calls a Ajax where the request is passed to a servlet in POST method. In the servlet i am using session variables for validation. I am using weblogic web server. The actual issue is when ...

39. feel confused about httpsession

where is session generated? in Web Server? I open a website in IE (let said IE1), then when open another IE (IE2) to that website, I invalidate my old session and create a new one (request.getSession(new)), then I go back to the old IE (IE1) and continue work, I feel surprise that the old IE (IE1) can use the new session ...

40. Using HttpSession in JSP

41. HttpSession

42. Servlets and HttpSession

This is my first attempt at writing a servlet. I'm trying to create a simple login page that directs users to their account page where they can update their account details and such. However I'm getting the feeling that I'm not doing this right. Do I really need to use HttpSession here? If so, what should I be using it for ...

43. Is javax.servlet.http.HttpSession is Serialized

In a servlet container you obtain an object of the type implementing HttpSession. The very type can implement Serializable or not, depending on the implementation, the API does not mandate this. As if I had seen somewhere a hint that you should only put Serializable stuff into the session, that is, that very container appears to use serialization to distribute the ...

44. HttpSession and HttpServlet singletons?