users@glassfish.java.net

Passing Objects between sessions

From: <glassfish_at_javadesktop.org>
Date: Tue, 23 Jun 2009 19:09:46 PDT

I have been searching for the answer to this for a long time and have finally gotten to the point where I need to ask.
I am trying to pass an object between basically two sessions in glass fish. Here is the situation:
I have one application running on a glassfish V2. This application has a webservice that other programs can post to and it serves out Google Earth KML network links. I am trying to get the information that is collected by the webservice to my managed java bean so that users have the latest information showing on the kml link. My managed bean has application scope.(I have also tried making the class into a singleton)
I have already tried several things such as the following:
FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
Controller myController = (Controller)app.createValueBinding("#{beanName}").getValue(ctx);

ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response = (HttpServletResponse)ectx.getResponse();
HttpSession session = (HttpSession)ectx.getSession(false);
Controller myController = (Controller) session.getValue("beanName");

Controller myController = (Controller) FacesContext.getCurrentInstance().getELContext().getELResolver().getValue(FacesContext.getCurrentInstance().getELContext(), null, " beanName ");

I have run it in debug mode and the bean that the webservice see’s will maintain the past data and keep adding updates as programs post to it. Unfortunately this is not the same bean that the user’s network links see. I would have thought that if you make a bean application scope that there would only ever be one object created. What am I missing? Is there something that needs to be setup with the webservice?
[Message sent by forum member 'jkeeney48' (jkeeney48)]

http://forums.java.net/jive/thread.jspa?messageID=352590