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

No, the Servlet API doesn’t provide a way. You really have to get hold of them all with help of a HttpSessionListener. You can find several examples in the following answers: How to find HttpSession by jsessionid? How to find number of active sessions per IP? How to check Who’s Online? How to invalidate another … Read more

How do you store Java objects in HttpSession?

You are not adding the object to the session, instead you are adding it to the request. What you need is: HttpSession session = request.getSession(); session.setAttribute(“MySessionVariable”, param); In Servlets you have 4 scopes where you can store data. Application Session Request Page Make sure you understand these. For more look here

Spring 3 MVC accessing HttpRequest from controller

Spring MVC will give you the HttpRequest if you just add it to your controller method signature: For instance: /** * Generate a PDF report… */ @RequestMapping(value = “/report/{objectId}”, method = RequestMethod.GET) public @ResponseBody void generateReport( @PathVariable(“objectId”) Long objectId, HttpServletRequest request, HttpServletResponse response) { // … // Here you can use the request and response … Read more

How to invalidate session in JSF 2.0?

Firstly, is this method correct? Is there a way without touching the ServletAPI? You can use ExternalContext#invalidateSession() to invalidate the session without the need to grab the Servlet API. @ManagedBean @SessionScoped public class UserManager { private User current; public String logout() { FacesContext.getCurrentInstance().getExternalContext().invalidateSession(); return “/home.xhtml?faces-redirect=true”; } // … } what will happen to my current … Read more