httpsession

Getting SessionScoped bean from HttpSessionListener?

不问归期 提交于 2019-12-01 12:36:59
Hey guys. I'm trying to get a session bean in a HttpSessionListener so that when the user logs out or the session expires I can delete some files that the user created in the application. I'm guessing the session bean doesn't exist because the session is destroyed. I was hoping to still delete these files some how. Thanks for the help. @WebListener public class SessionListener implements HttpSessionListener { @Override public void sessionCreated(HttpSessionEvent se) { HttpSession session = se.getSession(); System.out.print(getTime() + " (session) Created:"); System.out.println("ID=" + session

Getting SessionScoped bean from HttpSessionListener?

◇◆丶佛笑我妖孽 提交于 2019-12-01 10:26:47
问题 Hey guys. I'm trying to get a session bean in a HttpSessionListener so that when the user logs out or the session expires I can delete some files that the user created in the application. I'm guessing the session bean doesn't exist because the session is destroyed. I was hoping to still delete these files some how. Thanks for the help. @WebListener public class SessionListener implements HttpSessionListener { @Override public void sessionCreated(HttpSessionEvent se) { HttpSession session = se

Where is the HttpSession data stored?

我与影子孤独终老i 提交于 2019-12-01 07:37:37
HttpSession is a high level interface built on top of cookies and url-rewriting, which means that there is only a session ID is stored in client side and the data associated with it is stored in server side. Where is the HttpSession data actually stored in the server side? In the JVM memory or somewhere else? Can I change the place where to store it, e.g. save them into an in-memory database? If it's not in a database, is there any concurrency problem when many clients work on the same session data at the same time? It's up to the server where to store session data; the ones I'm familiar with

Where is the HttpSession data stored?

最后都变了- 提交于 2019-12-01 04:27:50
问题 HttpSession is a high level interface built on top of cookies and url-rewriting, which means that there is only a session ID is stored in client side and the data associated with it is stored in server side. Where is the HttpSession data actually stored in the server side? In the JVM memory or somewhere else? Can I change the place where to store it, e.g. save them into an in-memory database? If it's not in a database, is there any concurrency problem when many clients work on the same

Access session of another web application

折月煮酒 提交于 2019-11-30 20:05:12
Is it possible to configure two separate web apps (WAR) in a J2EE application (EAR) to access a shared session context? Further info: I ended up creating a shared class from the EAR which stored the required information in static members. This did the trick, even if it seemed like a dirty hack. Not directly. Most containers put each WAR in a separate classloader with the EAR classloader as their parent. Each app's sessions are separate. You can put something provided by the parent EAR in each session. If you need them to share something, make it a EAR function. As far as i've read and seen, it

Access session of another web application

情到浓时终转凉″ 提交于 2019-11-30 04:37:42
问题 Is it possible to configure two separate web apps (WAR) in a J2EE application (EAR) to access a shared session context? Further info: I ended up creating a shared class from the EAR which stored the required information in static members. This did the trick, even if it seemed like a dirty hack. 回答1: Not directly. Most containers put each WAR in a separate classloader with the EAR classloader as their parent. Each app's sessions are separate. You can put something provided by the parent EAR in

JSF logout using session.invalidate does not clear the current username?

假装没事ソ 提交于 2019-11-30 03:04:10
问题 In my JSF application, I get the name of the currently signed in user like this ... public String getLoggedInUsername() { return FacesContext.getCurrentInstance().getExternalContext().getRemoteUser(); } ... and I check if the user is signed in like this ... public boolean isSignedIn() { return (getLoggedInUsername() != null); } ... and when the user signs out, I do this ... public String doLogout() { FacesContext facesContext = FacesContext.getCurrentInstance(); HttpSession httpSession =

HTTP Session: how to configure URLs that not change the session expiration?

这一生的挚爱 提交于 2019-11-29 17:08:22
I have in my application polling HTTP requests that executed each 5 minutes. I want to configure those URLs not to change the session expiration. Otherwise my session will never expired (and I do not want it). Was not able to find it in the web.xml and HttpSession documentation. How is possible to do it? Added Very important clarification: the request should be authenticated. It means that the request should be attached to JsessionID that is already authenticated. Clarification (Added 2) I do not want the session will expire regardless of whether the user stays active or not. I want the

How to find out what open sessions my servlet based application is handling at any given moment

蹲街弑〆低调 提交于 2019-11-29 14:32:16
I need to write a servlet that, when called, gets information about a list of the currently opened sessions. Is there a way to do this? Implement HttpSessionListener , give it a static Set<HttpSession> property, add the session to it during sessionCreated() method, remove the session from it during sessionDestroyed() method, register the listener as <listener> in web.xml . Now you've a class which has all open sessions in the current JBoss instance collected. Here's a basic example: public HttpSessionCollector implements HttpSessionListener { private static final Set<HttpSession> sessions =

HttpSessionListener.sessionCreated() not being called

二次信任 提交于 2019-11-29 12:43:17
I have a very simple Servlet and a very simple HttpSessionListener: @WebServlet("/HelloWorld") public class HelloWorld extends HttpServlet { private static final long serialVersionUID = 1L; @Override public void init(ServletConfig config) throws ServletException { super.init(config); getServletContext().setAttribute("applicationHits", new AtomicInteger(0)); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("get"); ((AtomicInteger) request.getServletContext().getAttribute("applicationHits")).incrementAndGet