Hi Ben,

On Fri, 2008-03-21 at 23:05 -0400, Ben Neuman wrote:
> I am looking at using Orchestra for one of my projects but I'm having
> issues getting started. 
> I've created a very simple webapp with one managed bean:
> 
> <bean name="conversationAwareBean"
>         class="org.neuman.ConversationAwareBean"
>         scope="conversation.manual"/>
> 
> public class ConversationAwareBean implements Serializable,
> ConversationBindingListener {
> 
>     private String creationDate;
>     
>     public ConversationAwareBean() {
>         creationDate = new Date().toString();
>     }
>     public void valueBound(ConversationBindingEvent arg0)
>     {
>         System.out.println("********** I've been bound
> *****************");
>     }
> 
>     public void valueUnbound(ConversationBindingEvent arg0)
>     {
>         System.out.println("********** I've been unbound
> *****************");
>     }
> 
>     public String getDummy()
>     {
>         return creationDate;
>     }
> }
> 
> Now, I have just a couple of very simple jsf pages that output the value
> of creation date. I expected this value to remain constant while working
> within any given conversation. It doesn't. The date is updated on every
> and any request from my jsf pages. 
> Also, valueBound does get called once when the bean is first referenced.
> It is never called again after that. Even if I embed a link in a
> <o:separateConversationContext> tag which opens a new window, valueBound
> will not be called again. 
> 
> So it seems that I am doing something terribly wrong or I just am
> failing to grasp how this is all supposed to work. Any help would be
> greatly appreciated.

Your problem must be a simple configuration issue of some sort, because
what you've shown here looks ok, and the behaviour you expect is indeed
what should happen.

But I can't think what might be wrong with your setup. In the normal
(not multiwindow) setup ou are getting the valueBound callback once (and
once only) which is correct. That seems to indicate that you have the
SpringVariableResolver created correctly, and that the bean is created
just once then later fetched from the appropriate conversation.

You are using conversation.manual, not conversation.access, so there is
no possibility of the conversation being automatically discarded.
[check: the spring scope definition named "conversation.manual" does NOT
have <property name="lifetime" value="access"/>, right?]

You should see a query parameter "?conversationContext=1" appended to
all urls - except the one wrapped in the o:separateConversationContext.
If that is not happening for some reason, then you will get a new
conversation created for each request, and therefore the new date each
time. But in that case I would expect the valueBound method to be called
repeatedly which is not happening.

Odd.

All I can suggest is to compare your web.xml and spring config files
carefully against what is documented on the website, and what is in the
examples project:
http://svn.apache.org/repos/asf/myfaces/orchestra/trunk/examples/

You could also try enabling debug-level logging for category
"org.apache.myfaces.orchestra" and seeing if anything odd is being
reported there.

Regards,
Simon

Reply via email to