myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject Re: AW: Orchestra beginner question: conversation.flash behaves like request scope
Date Tue, 18 Mar 2008 13:38:51 GMT
Hi,

On Tue, Mar 18, 2008 at 7:01 AM, simon.kitching@chello.at
<simon.kitching@chello.at> wrote:
> Hi Stephan,
>
>  I'll need to ask Matthias to update his example ;-)

that is not mine. Mine is kind of up-to-date (facesgoodies)

-M

>
>  Everything looks ok in the logs. It just looks to me like your page is
>  not actually referencing anything from your controller bean.
>
>  Orchestra is assuming that in page regUserDirectPlanningController,
>  there is something that pulls data from the
>  regUserDirectPlanningController class during the render phase. Is this
>  not the case for your page? I would expect that somewhere in your page
>  you have  a component that accesses
>    #{regUserDirectPlanningController.reservationData}
>  or some other property on your controller bean. That access is how
>  Orchestra knows that the bean is still in use.
>
>  A "pure controller" bean, which handles postbacks but does not serve any
>  resources at all during the render phase is possible, though I would not
>  think it common. If your class is indeed a "pure controller" then you
>  can add a dummy component to the page, eg
>     <h:outputText rendered="#{regUserDirectPlanningController.class ==
>  null}"/>
>  Of course this rendered expression will never be true, so this will not
>  affect the page output in any way, but just evaluating the rendered
>  expression will tell Orchestra that the bean is still in use.
>
>  However:  do the beans
>   regUserDirectPlanningController
>   reservationJSF
>   simpleOrChainSelectionJSF
>   etc
>  all have the same lifetime, ie they should all be discarded together? If
>  so, then what you should do is add attribute
>   conversationName="regUser"
>  (or whatever name you want to choose) to each of the Spring bean
>  declarations. Then they all live in the same conversation. One effect is
>  that a reference to *any* of those beans will keep *all* of them alive
>  (because the common conversation is in use). Only when a render phase
>  accesses none of them will the conversation be discarded.
>
>  Regards, Simon
>
>
>  Stephan Frai schrieb:
>
>
> > Hello Simon,
>  >
>  > thank you for answering.
>  >
>  > I saw the old "flash" example here:
>  > http://myfaces-orchestra-goodies.googlecode.com/svn/trunk
>  >
>  > After I turned on logging I got the following logger output:
>  >
>  > 18 Mrz 2008 11:09:03,156 DEBUG [n.jsf.AccessScopePhaseListener: 161]
>  > Clearing access-scoped conversation regUserDirectPlanningController after
>  > rendering view /pages/ruplanning/regUserDirectPlanning.xhtml
>  > 18 Mrz 2008 11:09:03,171 DEBUG [stra.conversation.Conversation: 288] destroy
>  > conversation:regUserDirectPlanningController
>  > 18 Mrz 2008 11:09:03,171 DEBUG [n.jsf.AccessScopePhaseListener: 152] Not
>  > clearing accessed conversation reservationFormBean after rendering view
>  > /pages/ruplanning/regUserDirectPlanning.xhtml
>  > 18 Mrz 2008 11:09:03,171 DEBUG [n.jsf.AccessScopePhaseListener: 161]
>  > Clearing access-scoped conversation reservationJSF after rendering view
>  > /pages/ruplanning/regUserDirectPlanning.xhtml
>  > 18 Mrz 2008 11:09:03,171 DEBUG [stra.conversation.Conversation: 288] destroy
>  > conversation:reservationJSF
>  > 18 Mrz 2008 11:09:03,171 DEBUG [n.jsf.AccessScopePhaseListener: 152] Not
>  > clearing accessed conversation simpleOrChainSelectionJSF after rendering
>  > view /pages/ruplanning/regUserDirectPlanning.xhtml
>  > 18 Mrz 2008 11:09:03,171 DEBUG [n.jsf.AccessScopePhaseListener: 161]
>  > Clearing access-scoped conversation timeChainJSF after rendering view
>  > /pages/ruplanning/regUserDirectPlanning.xhtml
>  > 18 Mrz 2008 11:09:03,171 DEBUG [stra.conversation.Conversation: 288] destroy
>  > conversation:timeChainJSF
>  > 18 Mrz 2008 11:09:03,171 DEBUG [OrchestraFacesContextFactory$1: 129] Running
>  > release
>  > 18 Mrz 2008 11:09:03,171 DEBUG [dapter.jsf.JsfFrameworkAdapter:  69] Ending
>  > request
>  >
>  >
>  > 18 Mrz 2008 11:13:15,640 DEBUG [n.jsf.AccessScopePhaseListener: 161]
>  > Clearing access-scoped conversation regUserDirectPlanningController after
>  > rendering view /pages/ruplanning/regUserDirectPlanningConfirmation.xhtml
>  > 18 Mrz 2008 11:13:15,640 DEBUG [stra.conversation.Conversation: 288] destroy
>  > conversation:regUserDirectPlanningController
>  > 18 Mrz 2008 11:13:15,640 DEBUG [n.jsf.AccessScopePhaseListener: 161]
>  > Clearing access-scoped conversation reservationFormBean after rendering view
>  > /pages/ruplanning/regUserDirectPlanningConfirmation.xhtml
>  > 18 Mrz 2008 11:13:15,640 DEBUG [stra.conversation.Conversation: 288] destroy
>  > conversation:reservationFormBean
>  > 18 Mrz 2008 11:13:15,656 DEBUG [n.jsf.AccessScopePhaseListener: 152] Not
>  > clearing accessed conversation reservationJSF after rendering view
>  > /pages/ruplanning/regUserDirectPlanningConfirmation.xhtml
>  > 18 Mrz 2008 11:13:15,656 DEBUG [n.jsf.AccessScopePhaseListener: 161]
>  > Clearing access-scoped conversation simpleOrChainSelectionJSF after
>  > rendering view /pages/ruplanning/regUserDirectPlanningConfirmation.xhtml
>  > 18 Mrz 2008 11:13:15,656 DEBUG [stra.conversation.Conversation: 288] destroy
>  > conversation:simpleOrChainSelectionJSF
>  > 18 Mrz 2008 11:13:15,656 DEBUG [OrchestraFacesContextFactory$1: 129] Running
>  > release
>  > 18 Mrz 2008 11:13:15,656 DEBUG [dapter.jsf.JsfFrameworkAdapter:  69] Ending
>  > request
>  > 18 Mrz 2008 11:13:15,656 DEBUG [OrchestraFacesContextFactory$1: 138] Release
>  > completed
>  >
>  >
>  > As you can see, the converstion is destroyed after every rendered view of
>  > the workflow.
>  > Do I have to use the ViewController annotation?
>  >
>  >
>  > Greetings,
>  >
>  > Stephan
>  >
>  >
>  > -----Ursprüngliche Nachricht-----
>  > Von: simon.kitching@chello.at [mailto:simon.kitching@chello.at]
>  > Gesendet: Dienstag, 18. März 2008 10:34
>  > An: MyFaces Discussion
>  > Betreff: Re: Orchestra beginner question: conversation.flash behaves like
>  > request scope
>  >
>  > Stephan Frai schrieb:
>  >
>  >> Hello,
>  >>
>  >>
>  >>
>  >> I am new to orchestra and just integrated it into my application.
>  >>
>  >> Myfaces 1.2.2
>  >>
>  >> Hibernate 3.2.5
>  >>
>  >> Spring 2.0.4
>  >>
>  >>
>  >>
>  >> I`m using plain Hibernate without JPA, so I took the integration
>  >> provided at Google.
>  >>
>  >>
>  >>
>  >> Currently I am running into that problem that conversation.flash
>  >> behaves like request scope.
>  >>
>  >> I have a 4 step workflow and one controller bean for that workflow:
>  >>
>  >>
>  >>
>  >> <bean id="regUserDirectPlanningController"
>  >> class="com.playoli.ruplanning.jsf.RegUserDirectPlanningController"
>  >>
>  >>               scope="conversation.flash" depends-on="reservationJSF">
>  >>
>  >>             <property name="planningWorkflow"
>  >> ref="regUserDirectPlanning"/>
>  >>
>  >>             <property name="reservationData" ref="reservationFormBean"/>
>  >>
>  >>             <property name="chainData" ref="timeChainJSF"/>
>  >>
>  >>             <property name="reservationConfirmation"
>  >> ref="reservationJSF"/>
>  >>
>  >>             <property name="messageFormatter" ref="jsfMessageFormatter"/>
>  >>
>  >>             <property name="resourceManager" ref="resourceManager"/>
>  >>
>  >>             <!--
>  >>
>  >>             <property name="calendarJSF" ref="calendarJSF"/>
>  >>
>  >>              -->
>  >>
>  >>             <property name="reservationType"
>  >> ref="simpleOrChainSelectionJSF"/>
>  >>
>  >>             <property name="reservationFactory"
>  >> ref="reservationBeanFactory"/>
>  >>
>  >> </bean>
>  >>
>  >>
>  >>
>  >> The other beans that are referenced are either Singletons as they are
>  >> Business Objects, or they are also conversation scoped as they are
>  >> JsfBeans.
>  >>
>  >>
>  >>
>  >> My problem is, that for each step in my workflow a new empty
>  >> regUserDirectPlanningController is created and i lose the internal state.
>  >>
>  >> In debugger I can see that the AOP proxies around the conversation
>  >> scoped beans are properly created, so I think it`s kind of an
>  >> configuration problem.
>  >>
>  >>
>  >>
>  >> Does this problem sound familiar to anyone?
>  >>
>  >>
>  >>
>  >> If needed I can provide more detailed infos about configuration.
>  >>
>  >>
>  > You could try enabling debug level for the logging category
>  >
>  > "org.apache.myfaces.orchestra.conversation.jsf.OrchestraAccessScopePhaseList
>  > ener".
>  >
>  > This is the class that is responsible for discarding access-scope
>  > (formerly called "flash" scope) beans.
>  >
>  > By the way, the name "flash" is now deprecated; "access" is the
>  > preferred term. The old name should still work, but AFAIK all the
>  > examples have been updated to the new name. Where did you see the old one?
>  >
>  > Regards, Simon
>  >
>  >
>  >
>  >
>
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Mime
View raw message