session-scope

How to propagate CDI session beans from HTTP session to WebSocket session?

自闭症网瘾萝莉.ら 提交于 2020-01-05 13:38:14
问题 I googled a lot for this problem before posting this question and Accessing HttpSession from HttpServletRequest in a Web Socket @ServerEndpoint is one of the best Questions/Answers I was able to found, but it appears to not solve my problem. I was able to access HttpSession from websocket in this way, but I can't access the same CDI session bean instances as from normal HTTP requests. I tried to store in session the HttpSessionContextImpl Weld instance too and tried to use it on WebSocket

How to propagate CDI session beans from HTTP session to WebSocket session?

二次信任 提交于 2020-01-05 13:37:30
问题 I googled a lot for this problem before posting this question and Accessing HttpSession from HttpServletRequest in a Web Socket @ServerEndpoint is one of the best Questions/Answers I was able to found, but it appears to not solve my problem. I was able to access HttpSession from websocket in this way, but I can't access the same CDI session bean instances as from normal HTTP requests. I tried to store in session the HttpSessionContextImpl Weld instance too and tried to use it on WebSocket

Why should we make a SessionScoped ManagedBean thread safe in JSF?

冷暖自知 提交于 2019-12-21 12:09:13
问题 I know that Application-Scope persists across multiple users, so it's obvious that we should make sure that all the ApplicationScoped ManagedBeans are thread safe. I also understand that we don't need to care about thread safety for a RequestScoped ManagedBean. That's because it last only for one HTTP request, and is newly instantiated for each request if it's referenced. But I am not quite sure why we should worry about thread safety for a SessionScoped ManangedBean. Even though it persists

Session lost in Google App Engine using JSF

孤街醉人 提交于 2019-12-18 09:11:39
问题 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

MySQL: @variable vs. variable. Whats the difference? (Part2)

末鹿安然 提交于 2019-12-13 00:28:29
问题 Ok, building off of the last question I asked, How does Mysql handle the where statment in the following code: DELIMITER ;// DROP PROCEDURE IF EXISTS `test`;// CREATE PROCEDURE `test` ( id INT ) BEGIN SELECT * FROM some_table WHERE id = id; END;// What does MySQL do in this case? Does it treat the where clause as some_table.id = id or does it treat it like some_table.id = some_table.id Right now I am doing something like WHERE id = @id because I didn't know that there were session variables

Ajax Long Polling in Java, Spring MVC - session scope issue

狂风中的少年 提交于 2019-12-12 18:09:51
问题 I am trying to implement a long polling mechanism for auto-updating a grid in a project that uses Spring MVC. I am sending an Ajax request from the client and on the server side I enter a while loop until data is found then the data is send back as a response. I need to have another mechanism that stops this operation (that breaks off the loop) when the user changes tab in the application (every tab has a different grid that is auto-updating through long polling. Every tab is handled server

JSF 2: possible to initialize session-scoped beans on session start?

99封情书 提交于 2019-12-12 02:45:01
问题 Is it possible in JSF 2 to initialize a session-scoped managed bean as soon as the session context is loaded? I know it's possible with Application Scoped beans and the eager attribute in the @ManagedBean annotation, but does something similar exist for session beans? I have a session-scoped bean that I want to have loaded regardless of if a specific page is visited. 回答1: Are you sure you need a bean? If it is some general initialization stuff, you can use a HttpSessionListener , and on

Session scoped managed bean not available in servlet when using another browser than IE

二次信任 提交于 2019-12-11 20:10:17
问题 I have been using the following bit of code in a servlet to locate a session backing bean (as suggested by BalusC) without problems until recently. Now it only works on Internet Explorer. Chrome and Firefox appear to be getting a totally new backing bean rather than the original backing bean. When calling functions in the backing bean, it falls over with null pointer errors for objects in the backing bean that were definitely initialized in the original. FacesContext facesContext = FacesUtil

JSF SessionScoped bean not retaining properties

和自甴很熟 提交于 2019-12-11 16:26:04
问题 I am working on a jsf app using primefaces and have a SalesBean which is used by various views @ManagedBean @ViewScoped public class SalesBean implements Serializable, IGlobals { private static final long serialVersionUID = 2384518099615211725L; @ManagedProperty(value = "#{applicationBean}") private ApplicationBean application; @ManagedProperty(value = "#{sessionSettingsBean}") private SessionSettingsBean settings; @PostConstruct public void refresh() { this.trader=settings.getSelectedTrader(

How to retrieve a session scoped managed bean in a PhaseListener?

血红的双手。 提交于 2019-12-11 07:35:29
问题 I'm having troubles in setting an Authorization Listener (that implements PhaseListener) to manage authentication and autorization. More specifically, I set a session scoped bean called SessionBean: @ManagedBean @SessionScoped public class SessionBean{ private String loggedUser; public SessionBean(){ logger.info("Sono nel costruttore di SessionBean()"); } public String login(){ .... } ... } And in my sun-web.xml: <managed-bean> <managed-bean-name>SessionBean</managed-bean-name> <managed-bean