You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@openwebbeans.apache.org by Sven Linstaedt <sv...@googlemail.com> on 2009/11/11 00:04:45 UTC
Starting long running conversations
Hi,
because I am just fiddling around with long running (aka non transient)
conversations, I would like to know, if someone has dealt with the problem
of starting a long running conversation during a nonfaces (GET) request
before.
My current (not working) solution is, using a conversation scoped controller
bean in the view, which get's instantiated during the render response phase
and which set the conversation'S transient state in it's @PostConstruct
method. Unfortunately OWB (have not tested weld yet) does it's
"conversation.isTransient()" check before that phase, so the conversation's
ID won't get populated to the view's attributes
(org.apache.webbeans.jsf.WebBeansPhaseListener:170) and thus is not
available on the next post back, resulting in a new conversation being
started.
>From my experience with Seam I remember they used some kind of external xml
configuration that maps URLs to action (like the traditional url controller
frameworks like struts). I would not like to use a similar mechanism in my
application, because I do not like xml files after all ;) so here is my
question:
What do you think is the best way to start a long running conversation from
a GET request?
br, Sven
Re: Starting long running conversations
Posted by Sven Linstaedt <sv...@googlemail.com>.
Thanks for the hint, Gurkan.
br, Sven
2009/11/11 Mark Struberg <st...@yahoo.de>
> Yes, I meant CID (the Conversation ID) ;)
>
> I had a discussion with Pete a long time ago whether 299 should provide a
> static accessor (like the FacesContext). This would also be very handy for
> legacy projects if not all parts of the projects use a DI container and the
> injection chain is interrupted. But currently there are only the 2 ways
> defined in the spec: via JNDI or via @Inject.
>
> Look at
> webbeans-impl/src/main/java/org/apache/webbeans/spi/conversation/ConversationService.java
> and the corresponding implementation in the webbeans-jsf. Maybe this helps.
>
> LieGrue,
> strub
>
>
> *Von:* Gurkan Erdogdu <gu...@yahoo.com>
>
> *An:* openwebbeans-user@incubator.apache.org
> *Gesendet:* Mittwoch, den 11. November 2009, 18:23:01 Uhr
> *Betreff:* Re: Starting long running conversations
>
> Hi Sven;
>
> I think that Mark would like to say CID.
>
> You can get BeanManager via injection @Inject BeanManager. You could also
> use internal API ActivityManager.getInstance().getRootActivity()
>
> Thanks;
>
> --Gurkan
> ------------------------------
> *From:* Sven Linstaedt <sv...@googlemail.com>
> *To:* openwebbeans-user@incubator.apache.org
> *Sent:* Wed, November 11, 2009 6:30:52 PM
> *Subject:* Re: Starting long running conversations
>
> Hi Mark,
>
> I agree with you that this should not be part of the spec. I took a brief
> look at the number guess example. In this application the conversation is
> started during a postback action event. This implies the "calling" page
> knows about the fact, the upcoming page needs an long running conversation,
> which is not the behavior I am looking for.
>
> Anyhow I have not understand your last sentence at all. I believe instead
> of CDI (context and dependency injection?) you mean CID, which is managed by
> OWB.
>
> My current plan is writing a FaceletHandler, which is used in the view's
> metadata block to annotate this view for requiring a long runnung
> conversation. For this task I have to lookup the current conversation
> (likely) from the BeanManager, which in turn needs to be looked up too. Do
> you know if there is any way to lookup the BeanManager from outside of CDI
> other than trough JNDI's java:comp/BeanManager?
>
> br, Sven
>
>
> 2009/11/11 Mark Struberg <st...@yahoo.de>
>
>> Hi Sven!
>>
>> JSR-299 doesn't define any such UI mechanisms like SEAM or Springs
>> @Controllers.
>> But it would be pretty easy to implement those, e.g. in the guess sample.
>> It should imho not be part of the core though.
>>
>> As a small tip: We already have an OWB-internal SPI for conversation
>> handling and James and I managed to implement conversations for Wicket UIs.
>> The basic question is where to store something like the CDI of the
>> FacesContext in the renderes html.
>>
>> LieGrue,
>> strub
>>
>>
>> *Von:* Sven Linstaedt <sv...@googlemail.com>
>> *An:* openwebbeans-user@incubator.apache.org
>> *Gesendet:* Mittwoch, den 11. November 2009, 0:04:45 Uhr
>> *Betreff:* Starting long running conversations
>>
>> Hi,
>>
>> because I am just fiddling around with long running (aka non transient)
>> conversations, I would like to know, if someone has dealt with the problem
>> of starting a long running conversation during a nonfaces (GET) request
>> before.
>>
>> My current (not working) solution is, using a conversation scoped
>> controller bean in the view, which get's instantiated during the render
>> response phase and which set the conversation'S transient state in it's
>> @PostConstruct method. Unfortunately OWB (have not tested weld yet) does
>> it's "conversation.isTransient()" check before that phase, so the
>> conversation's ID won't get populated to the view's attributes
>> (org.apache.webbeans.jsf.WebBeansPhaseListener:170) and thus is not
>> available on the next post back, resulting in a new conversation being
>> started.
>>
>> From my experience with Seam I remember they used some kind of external
>> xml configuration that maps URLs to action (like the traditional url
>> controller frameworks like struts). I would not like to use a similar
>> mechanism in my application, because I do not like xml files after all ;) so
>> here is my question:
>>
>> What do you think is the best way to start a long running conversation
>> from a GET request?
>>
>>
>> br, Sven
>>
>>
>>
>
>
>
AW: Starting long running conversations
Posted by Mark Struberg <st...@yahoo.de>.
Yes, I meant CID (the Conversation ID) ;)
I had a discussion with Pete a long time ago whether 299 should provide a static accessor (like the FacesContext). This would also be very handy for legacy projects if not all parts of the projects use a DI container and the injection chain is interrupted. But currently there are only the 2 ways defined in the spec: via JNDI or via @Inject.
Look at webbeans-impl/src/main/java/org/apache/webbeans/spi/conversation/ConversationService.java
and the corresponding implementation in the webbeans-jsf. Maybe this helps.
LieGrue,
strub
>
>Von: Gurkan Erdogdu <gu...@yahoo.com>
>An: openwebbeans-user@incubator.apache.org
>Gesendet: Mittwoch, den 11. November 2009, 18:23:01 Uhr
>Betreff: Re: Starting long running conversations
>
>
>Hi Sven;
>
>I think that Mark would like to say CID.
>
>You can get BeanManager via injection @Inject BeanManager. You could also use internal API ActivityManager.getInstance().getRootActivity()
>
>Thanks;
>
>--Gurkan
>
>
________________________________
From: Sven Linstaedt <sv...@googlemail.com>
>To: openwebbeans-user@incubator.apache.org
>Sent: Wed, November 11, 2009 6:30:52 PM
>Subject: Re: Starting long running
> conversations
>
>> Hi Mark,
>
>I agree with you that this should not be part of the spec. I took a brief look at the number guess example. In this application the conversation is started during a postback action event. This implies the "calling" page knows about the fact, the upcoming page needs an long running conversation, which is not the behavior I am looking for.
>
>Anyhow I have not understand your last sentence at all. I believe instead of CDI (context and dependency injection?) you mean CID, which is managed by OWB.
>
>My current plan is writing a FaceletHandler, which is used in the view's metadata block to annotate this view for requiring a long runnung conversation. For this task I have to lookup the current conversation (likely) from the BeanManager, which in turn needs to be looked up too. Do you know if there is any way to lookup the BeanManager from outside of CDI other than trough JNDI's java:comp/BeanManager?
>
>br, Sven
>
>
>
>2009/11/11 Mark Struberg <st...@yahoo.de>
>
>Hi Sven!
>>
>>JSR-299 doesn't define any such UI mechanisms like SEAM or Springs @Controllers.
>>But it would be pretty easy to implement those, e.g. in the guess sample.
>>>>It should imho not be part of the core though.
>>
>>As a small tip: We already have an OWB-internal SPI for conversation handling and James and I managed to implement conversations for Wicket UIs. The basic question is where to store something like the CDI of the FacesContext in the renderes html.
>>
>>LieGrue,
>>strub
>>
>>
>>>
>>>Von: Sven Linstaedt <sv...@googlemail.com>
>>>An: openwebbeans-user@incubator.apache.org
>>>Gesendet: Mittwoch, den 11. November 2009, 0:04:45 Uhr
>>>Betreff: Starting long running conversations
>>>
>>>
>>>Hi,
>>>
>>>because I am just fiddling around with long running (aka non transient) conversations, I would like to know, if someone has dealt with the problem of starting a long running conversation during a nonfaces (GET) request before.
>>>
>>>My current (not working) solution is, using a conversation scoped controller bean in the view, which get's instantiated during the render response phase and which set the conversation'S transient state in it's @PostConstruct method. Unfortunately OWB (have not tested weld yet) does it's "conversation.isTransient()" check before that phase, so the conversation's ID won't get populated to the view's attributes (org.apache.webbeans.jsf.WebBeansPhaseListener:170) and thus is not available on the next post back, resulting in a new conversation being started.
>>>
>>>From my experience with Seam I remember they used some kind of external xml configuration that maps URLs to action (like the traditional url controller frameworks like struts). I would not like to use a similar mechanism in my application, because I do not like xml files after all ;) so here is my question:
>>>
>>>What do you think is the best way to start a long running conversation from a GET request?
>>>
>>>
>>>br, Sven
>>>
>>
>
>
Re: Starting long running conversations
Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Hi Sven;
I think that Mark would like to say CID.
You can get BeanManager via injection @Inject BeanManager. You could also use internal API ActivityManager.getInstance().getRootActivity()
Thanks;
--Gurkan
________________________________
From: Sven Linstaedt <sv...@googlemail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Wed, November 11, 2009 6:30:52 PM
Subject: Re: Starting long running conversations
Hi Mark,
I agree with you that this should not be part of the spec. I took a brief look at the number guess example. In this application the conversation is started during a postback action event. This implies the "calling" page knows about the fact, the upcoming page needs an long running conversation, which is not the behavior I am looking for.
Anyhow I have not understand your last sentence at all. I believe instead of CDI (context and dependency injection?) you mean CID, which is managed by OWB.
My current plan is writing a FaceletHandler, which is used in the view's metadata block to annotate this view for requiring a long runnung conversation. For this task I have to lookup the current conversation (likely) from the BeanManager, which in turn needs to be looked up too. Do you know if there is any way to lookup the BeanManager from outside of CDI other than trough JNDI's java:comp/BeanManager?
br, Sven
2009/11/11 Mark Struberg <st...@yahoo.de>
Hi Sven!
>
>JSR-299 doesn't define any such UI mechanisms like SEAM or Springs @Controllers.
>But it would be pretty easy to implement those, e.g. in the guess sample.
>>It should imho not be part of the core though.
>
>As a small tip: We already have an OWB-internal SPI for conversation handling and James and I managed to implement conversations for Wicket UIs. The basic question is where to store something like the CDI of the FacesContext in the renderes html.
>
>LieGrue,
>strub
>
>
>>
>>Von: Sven Linstaedt <sv...@googlemail.com>
>>An: openwebbeans-user@incubator.apache.org
>>Gesendet: Mittwoch, den 11. November 2009, 0:04:45 Uhr
>>Betreff: Starting long running conversations
>>
>>
>>Hi,
>>
>>because I am just fiddling around with long running (aka non transient) conversations, I would like to know, if someone has dealt with the problem of starting a long running conversation during a nonfaces (GET) request before.
>>
>>My current (not working) solution is, using a conversation scoped controller bean in the view, which get's instantiated during the render response phase and which set the conversation'S transient state in it's @PostConstruct method. Unfortunately OWB (have not tested weld yet) does it's "conversation.isTransient()" check before that phase, so the conversation's ID won't get populated to the view's attributes (org.apache.webbeans.jsf.WebBeansPhaseListener:170) and thus is not available on the next post back, resulting in a new conversation being started.
>>
>>>From my experience with Seam I remember they used some kind of external xml configuration that maps URLs to action (like the traditional url controller frameworks like struts). I would not like to use a similar mechanism in my application, because I do not like xml files after all ;) so here is my question:
>>
>>What do you think is the best way to start a long running conversation from a GET request?
>>
>>
>>br, Sven
>>
>
Re: Starting long running conversations
Posted by Sven Linstaedt <sv...@googlemail.com>.
Hi Mark,
I agree with you that this should not be part of the spec. I took a brief
look at the number guess example. In this application the conversation is
started during a postback action event. This implies the "calling" page
knows about the fact, the upcoming page needs an long running conversation,
which is not the behavior I am looking for.
Anyhow I have not understand your last sentence at all. I believe instead of
CDI (context and dependency injection?) you mean CID, which is managed by
OWB.
My current plan is writing a FaceletHandler, which is used in the view's
metadata block to annotate this view for requiring a long runnung
conversation. For this task I have to lookup the current conversation
(likely) from the BeanManager, which in turn needs to be looked up too. Do
you know if there is any way to lookup the BeanManager from outside of CDI
other than trough JNDI's java:comp/BeanManager?
br, Sven
2009/11/11 Mark Struberg <st...@yahoo.de>
> Hi Sven!
>
> JSR-299 doesn't define any such UI mechanisms like SEAM or Springs
> @Controllers.
> But it would be pretty easy to implement those, e.g. in the guess sample.
> It should imho not be part of the core though.
>
> As a small tip: We already have an OWB-internal SPI for conversation
> handling and James and I managed to implement conversations for Wicket UIs.
> The basic question is where to store something like the CDI of the
> FacesContext in the renderes html.
>
> LieGrue,
> strub
>
>
> *Von:* Sven Linstaedt <sv...@googlemail.com>
> *An:* openwebbeans-user@incubator.apache.org
> *Gesendet:* Mittwoch, den 11. November 2009, 0:04:45 Uhr
> *Betreff:* Starting long running conversations
>
> Hi,
>
> because I am just fiddling around with long running (aka non transient)
> conversations, I would like to know, if someone has dealt with the problem
> of starting a long running conversation during a nonfaces (GET) request
> before.
>
> My current (not working) solution is, using a conversation scoped
> controller bean in the view, which get's instantiated during the render
> response phase and which set the conversation'S transient state in it's
> @PostConstruct method. Unfortunately OWB (have not tested weld yet) does
> it's "conversation.isTransient()" check before that phase, so the
> conversation's ID won't get populated to the view's attributes
> (org.apache.webbeans.jsf.WebBeansPhaseListener:170) and thus is not
> available on the next post back, resulting in a new conversation being
> started.
>
> From my experience with Seam I remember they used some kind of external xml
> configuration that maps URLs to action (like the traditional url controller
> frameworks like struts). I would not like to use a similar mechanism in my
> application, because I do not like xml files after all ;) so here is my
> question:
>
> What do you think is the best way to start a long running conversation from
> a GET request?
>
>
> br, Sven
>
>
>
AW: Starting long running conversations
Posted by Mark Struberg <st...@yahoo.de>.
Hi Sven!
JSR-299 doesn't define any such UI mechanisms like SEAM or Springs @Controllers.
But it would be pretty easy to implement those, e.g. in the guess sample.
It should imho not be part of the core though.
As a small tip: We already have an OWB-internal SPI for conversation handling and James and I managed to implement conversations for Wicket UIs. The basic question is where to store something like the CDI of the FacesContext in the renderes html.
LieGrue,
strub
>
>Von: Sven Linstaedt <sv...@googlemail.com>
>An: openwebbeans-user@incubator.apache.org
>Gesendet: Mittwoch, den 11. November 2009, 0:04:45 Uhr
>Betreff: Starting long running conversations
>
>Hi,
>
>because I am just fiddling around with long running (aka non transient) conversations, I would like to know, if someone has dealt with the problem of starting a long running conversation during a nonfaces (GET) request before.
>
>My current (not working) solution is, using a conversation scoped controller bean in the view, which get's instantiated during the render response phase and which set the conversation'S transient state in it's @PostConstruct method. Unfortunately OWB (have not tested weld yet) does it's "conversation.isTransient()" check before that phase, so the conversation's ID won't get populated to the view's attributes (org.apache.webbeans.jsf.WebBeansPhaseListener:170) and thus is not available on the next post back, resulting in a new conversation being started.
>
>From my experience with Seam I remember they used some kind of external xml configuration that maps URLs to action (like the traditional url controller frameworks like struts). I would not like to use a similar mechanism in my application, because I do not like xml files after all ;) so here is my question:
>
>What do you think is the best way to start a long running conversation from a GET request?
>
>
>br, Sven
>