session-scope

Remove/destroy session scoped CDI managed bean

血红的双手。 提交于 2019-12-10 16:48:29
问题 I have a session scoped CDI managed bean: @Named @SessionScoped public class SampleBean implements Serializable { // ... } I need to remove this bean from the session after a certain flow for which I used the following code like as seen in this answer: ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); ec.getSessionMap().remove("sampleBean"); However, it does not work and the SampleBean remains in the session. Am I missing something? 回答1: In contrary to JSF managed

How to retrieve a session-scoped bean inside AuthenticationSuccessHandler?

泪湿孤枕 提交于 2019-12-10 07:41:46
问题 I have a custom AuthenticationSuccessHandler. What I want to do is to set some session data within onAuthenticationSuccess method. To store session data I want to use a session-scoped bean, which works fine within any controller. But if I try to retrieve it within onAuthenticationSuccess method, I get an exception: Error creating bean with name 'scopedTarget.sessionData': Scope 'session' is not active for the current thread; My code is: WebApplicationContext context =

How to retrieve a session-scoped bean inside AuthenticationSuccessHandler?

谁都会走 提交于 2019-12-05 13:21:59
I have a custom AuthenticationSuccessHandler. What I want to do is to set some session data within onAuthenticationSuccess method. To store session data I want to use a session-scoped bean, which works fine within any controller. But if I try to retrieve it within onAuthenticationSuccess method, I get an exception: Error creating bean with name 'scopedTarget.sessionData': Scope 'session' is not active for the current thread; My code is: WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext()); SessionData sessionData = context

Access session scoped JSF managed bean in web filter

ⅰ亾dé卋堺 提交于 2019-11-30 11:21:04
I have SessionScoped bean called userSession to keep track of the user ( username, ifLogged, etc). I want to filter some pages and therefore I need to access the bean from the webFilter I created. How do I do that? I looks like its even impossible to import the bean to be potenitally visible. BalusC Under the covers, JSF stores session scoped managed beans as an attribute of the HttpSession with the managed bean name as key. So, provided that you've a @ManagedBean @SessionScoped public class User {} , just this should do inside the doFilter() method: HttpSession session = ((HttpServletRequest)

Access session scoped JSF managed bean in web filter

随声附和 提交于 2019-11-29 16:57:17
问题 I have SessionScoped bean called userSession to keep track of the user ( username, ifLogged, etc). I want to filter some pages and therefore I need to access the bean from the webFilter I created. How do I do that? I looks like its even impossible to import the bean to be potenitally visible. 回答1: Under the covers, JSF stores session scoped managed beans as an attribute of the HttpSession with the managed bean name as key. So, provided that you've a @ManagedBean @SessionScoped public class

Session lost in Google App Engine using JSF

╄→гoц情女王★ 提交于 2019-11-29 15:38:36
I have configured JSF 2.1 in my Google App Engine application following the indications at: https://sites.google.com/a/wildstartech.com/adventures-in-java/Java-Platform-Enterprise-Edition/JavaServer-Faces/javaserver-faces-21/configuring-javaserver-faces-21-to-run-on-the-google-app-engine-using-eclipse The application works perfectly when running locally, but the session is lost when deployed at Google App Engine, e.g.: the component values are lost when updating any other component in the page, and the SessionScope backing bean fields are also lost. My web.xml file is: <?xml version="1.0"

request scoped property in session scoped JSF bean

↘锁芯ラ 提交于 2019-11-29 04:12:38
I would like to have a session scoped JSF bean with one property that is request (page) scoped. Is it possible at all? No, that's not possible. Managed property injection only happens during creation of the bean. However, when a session scoped bean is been created there is not necessarily a request present and the injected request scoped bean would be invalid in subsequent requests in the remnant of the session. Do it the other way round. E.g. @ManagedBean @SessionScoped public class UserManager { private User current; // ... } and @ManagedBean @RequestScoped public class Login { private

How does a ScopedProxy decide what Session to use?

旧街凉风 提交于 2019-11-29 01:53:07
A Singleton can not autowire a SessionBean but a ScopedProxy can. Assuming 100 users have a valid Session at the same time in the same application, how does the ScopedProxy decide what session is meant? I don't think the ScopedProxy is choosing any random session, this would be nonsense in my opinion. How does the ScopedProxy decide what session to use? What if 0 users have a Session? Will a NullPointerException occur? A @Async is a different Thread than the invoking Request-Processing-Thread how to inject the HttpRequest-Context to the Async task? Renat Gilmanov ThreadLocal is pretty much the

Access session scoped bean from request scoped bean

别说谁变了你拦得住时间么 提交于 2019-11-28 08:49:51
I'm trying to use a pattern found on a IceFaces page.(I'm not using IceFaces, using PrimeFaces) In this case I have two beans: UserController and Usermodel On my UserModel I have a instance of UserVO (created by another programmer). On My UserController I have this: @ManagedBean @RequestScoped public class UserController implements Serializable { private static final long serialVersionUID = 1L; private UserBO bo; private UserModel model; public UserController() { bo = new UserBO(); model = new UserModel(); } public void Login() throws IOException { model.setUserVo(bo.executeLogin(model

request scoped property in session scoped JSF bean

放肆的年华 提交于 2019-11-27 18:07:11
问题 I would like to have a session scoped JSF bean with one property that is request (page) scoped. Is it possible at all? 回答1: No, that's not possible. Managed property injection only happens during creation of the bean. However, when a session scoped bean is been created there is not necessarily a request present and the injected request scoped bean would be invalid in subsequent requests in the remnant of the session. Do it the other way round. E.g. @ManagedBean @SessionScoped public class