httpsession

Struts 2 Session Management. I am not able to create session

孤街浪徒 提交于 2019-12-02 18:56:15
问题 I am not able to manage Session with Struts2 . If I login successfully and if I click the URL of login again, it again asks for login. I want it to be logged in till timeout doesn't happens. 回答1: The session is already managed in Struts2. If you want to put some object like an user to the session you can use authentication interceptor like this. It checks if an user in session and let the action invoke, otherwise it returns a login result. The user might want to login several times under

Spring session-scoped beans as dependencies in prototype beans?

无人久伴 提交于 2019-12-02 17:43:58
I read spring docs on this subject several times, but some things are still unclear to me. Documentation states: If you want to inject (for example) an HTTP request scoped bean into another bean, you must inject an AOP proxy in place of the scoped bean. That is, you need to inject a proxy object that exposes the same public interface as the scoped object but that can also retrieve the real, target object from the relevant scope (for example, an HTTP request) and delegate method calls onto the real object. Config example is as follows: <bean id="userPreferences" class="com.foo.UserPreferences"

How to store session in Spring MVC

你说的曾经没有我的故事 提交于 2019-12-02 15:08:47
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 controller beans, and storing the data in a session object ? Session-scoped beans (using scope="session" ) is the cleanest approach. This removes the need to interact with the session yourself. If you want to autowire a session-scoped bean in to the controller, you either need to make the controller session-scoped itself, or use a scoped-proxy to wire

Store and invalidate Java HttpSession from different user

最后都变了- 提交于 2019-12-02 12:13:32
问题 Okay. What I want to do is be able to, when I update a user, invalidate any session that they currently have in order to force a refresh of credentials. I don't care about being able to directly access the session-specific user data. Ideally, I would also be able to restrict users to one session by a similar manner. What I tried doing is creating a HashMap using the username as key and HttpSession as the value (my actual setup is a little more involved, but after repeated seemingly

Struts 2 Session Management. I am not able to create session

怎甘沉沦 提交于 2019-12-02 09:44:31
I am not able to manage Session with Struts2 . If I login successfully and if I click the URL of login again, it again asks for login. I want it to be logged in till timeout doesn't happens. Roman C The session is already managed in Struts2. If you want to put some object like an user to the session you can use authentication interceptor like this . It checks if an user in session and let the action invoke, otherwise it returns a login result. The user might want to login several times under different accounts, so you should not restrict him/her from doing it. In the JSP you could check the

When does JSF creates a session & what does it puts in a session map?

穿精又带淫゛_ 提交于 2019-12-02 06:31:35
I am running Mojarra 2.2.0. <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> The managed bean action method is- public void action() { HttpSession session = (HttpSession) FacesContext.getCurrentInstance() .getExternalContext().getSession(false); System.out.println(session.getId()); // not null for stateful views } For stateless views session.getId() throws NPE For views which are not stateless- Firing a GET request, there is JSESSIONID=340041C96D5AA446D761C3602F54A76D I read it here that- For client side state saving

Store and invalidate Java HttpSession from different user

China☆狼群 提交于 2019-12-02 04:32:01
Okay. What I want to do is be able to, when I update a user, invalidate any session that they currently have in order to force a refresh of credentials. I don't care about being able to directly access the session-specific user data. Ideally, I would also be able to restrict users to one session by a similar manner. What I tried doing is creating a HashMap using the username as key and HttpSession as the value (my actual setup is a little more involved, but after repeated seemingly inexplicable failures, I boiled it down to this simple test). However, whenever I attempt to tell the retrieved

Retrieve browser locale from httpsession?

北城以北 提交于 2019-12-02 04:03:26
问题 Is it possible to derive the preferred language from a httpsession object (javax.servlet.http.HttpSession) ? It is possible to get it from the servletrequest but I dont have that. Thanks for any ideas. Sven 回答1: The preferred Locale for a user is available as a request header ("Accept-Language"). It is automatically filled in by the user's browser according to its preferences. Then, you can store this info in the user's session and retrieve it later when appropriate. 回答2: usually we cannot

Retrieve browser locale from httpsession?

若如初见. 提交于 2019-12-01 23:46:40
Is it possible to derive the preferred language from a httpsession object (javax.servlet.http.HttpSession) ? It is possible to get it from the servletrequest but I dont have that. Thanks for any ideas. Sven The preferred Locale for a user is available as a request header ("Accept-Language"). It is automatically filled in by the user's browser according to its preferences. Then, you can store this info in the user's session and retrieve it later when appropriate. usually we cannot from a HttpSession get the relevant httpRequest object. However there is a workaround. You can create a Filter, in

Accessing HttpSession outside of the originally receiving thread

天大地大妈咪最大 提交于 2019-12-01 18:23:41
I'm using Spring 3. When controller gets requests it passes control to method someMethod() annotated with @Async in Service bean and then returns. When I access in someMethod() HttpSession object I receive this exception java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case