myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephan Frai" <facesMaili...@online.de>
Subject AW: AW: Orchestra beginner question: conversation.flash behaves like request scope
Date Tue, 18 Mar 2008 12:37:58 GMT
Hi Simon,

thanks for your help.
After I had given the conversation a name, everything worked fine.

I`ve got a last question:
May I specify more than one conversationName per bean?
Because I`m using the same bean in different workflows.

E.g:

<bean id="timeChainJSF" class="com.playoli.timeperiod.jsf.TimeChainJSF"
scope="conversation.access"
 orchestra:conversationName="regUserDirectPlanning,regUserRequestPlanning">
	<property name="beanFactory" ref="timePeriodBeanFactory" />
	<property name="timePeriodValidation" ref="timePeriodValidation"/>
</bean>

Or do I have to define two separate beans in Spring:

<bean id="timeChainJSF_1" class="com.playoli.timeperiod.jsf.TimeChainJSF"
scope="conversation.access"
	 orchestra:conversationName="regUserDirectPlanning">
	<property name="beanFactory" ref="timePeriodBeanFactory" />
	<property name="timePeriodValidation" ref="timePeriodValidation"/>
</bean>

<bean id="timeChainJSF_2" class="com.playoli.timeperiod.jsf.TimeChainJSF"
scope="conversation.access"
	 orchestra:conversationName="regUserRequestPlanning">
	<property name="beanFactory" ref="timePeriodBeanFactory" />
	<property name="timePeriodValidation" ref="timePeriodValidation"/>
</bean>


Regards,

Stephan

-----Ursprüngliche Nachricht-----
Von: simon.kitching@chello.at [mailto:simon.kitching@chello.at] 
Gesendet: Dienstag, 18. März 2008 12:01
An: MyFaces Discussion
Betreff: Re: AW: Orchestra beginner question: conversation.flash behaves
like request scope

Hi Stephan,

I'll need to ask Matthias to update his example ;-)

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
>
>
>
>   



Mime
View raw message