[JBoss Seam] - Re: @Startup (possible to have this occur post session creat
by courtneycouch
"petemuir" wrote : "courtneycouch" wrote : The reason for this is that ajax4jsf mediaOutput components cant be seam component. They need to be simply managed-beans. When I'm using managed-beans in a seam application the regular lifecycle stuff for managed-beans doesnt work since seam is in control.
|
| This is something that is broken then - we/a4j ought to fix this as you should be able to use a Seam component here. Have you talked to the a4j guys about this?
|
| anonymous wrote : Kind of a hack I suppose.. the problem is fc.getApplication().getVariableResolver().resolveVariable() called from within a @Create method of a component tahts marked @Startup just starts an infinite loop.
|
| Well yes, this is a loop ;) I haven't got the whole picture here, but, for your workaround, why not lazy-initialize the proxy?
Here is the thread from the ajax4jsf users: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=107203
Perhaps I misunderstood but I got the impression that ajax4jsf purposely doesnt operate in the way I'm trying "You can use the whole JSF lifecycle with restoring the session for each request to resources like this OR serialize only the required data and pass it directly to the method. " seems to imply that.
As far as lazy initializing, I need the managed-bean to have access to seam components, if its lazy initialized then its initialized outside of the seam context and cant access them. Seam has to initialize the managed beans so I have to create a seam component whose sole purpose is initializing the managed-beans. Since thats its only purpose, I simply have a #{managedBeanLoader.load} in the template.
Once the managed bean has a reference to a seam context its good to go..I was just hoping I could find a better way than call the seam component above on every seam request jsut to make sure that the managed-beans are instantiated from seam not ajax4jsf.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041790#4041790
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041790
17 years, 9 months
[JBoss Seam] - Re: @Startup (possible to have this occur post session creat
by courtneycouch
"petemuir" wrote : Seam's session context is driven by the web application. Seam is notified when the session has been created and processes the creation of @Startup @Scope(SESSION) components. We are calling the hooks as late as possible afaics.
|
| What are you trying to do - which methods? What is going wrong - whats the stack?
I'm trying to initialize some managed-beans configured in faces-config.
The reason for this is that ajax4jsf mediaOutput components cant be seam component. They need to be simply managed-beans. When I'm using managed-beans in a seam application the regular lifecycle stuff for managed-beans doesnt work since seam is in control.
What I was trying to do instead was simply (from inside a seam component)
fc.getApplication().getVariableResolver().resolveVariable("manageBean")
to get ahold of the managed bean, then inside the managed bean:
org.jboss.seam.contexts.Contexts.getSessionContext().get("someComponent")
So the managed-bean would simply be a facade into the real seam component that its calling. (as a workaround to ajax4jsf not letting me use seam components).
I need to have access to the seam contexts from the managed-bean and if I dont initialize the managed-bean from a seam component then org.jboss.seam.contexts.Contexts.getSessionContext().get() throws a null error.
Kind of a hack I suppose.. the problem is fc.getApplication().getVariableResolver().resolveVariable() called from within a @Create method of a component tahts marked @Startup just starts an infinite loop.
When I simply instantiate the seam component manually everything works perfectly.. the ajax4jsf stuff.. the managed-bean, etc.
Maybe I'm going about this the wrong way?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041786#4041786
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041786
17 years, 9 months