wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Stoch <daniel.st...@gmail.com>
Subject Re: How to call onResourceRequested for page behavior in ajax update (Atmosphere related)
Date Fri, 12 Dec 2014 09:36:24 GMT
Hi,

Ok, I think I didn't described a problem well.

When you add a component which subscribes some events, then
AtmosphereBehavior is added to page. But the wicketAtmosphere JS
callback is registered inside AtmosphereBehavior.renderHead() method,
so only (I think) when the whole page is rendered. When you add a
component using ajax, then this code (renderHead) is not called, so
events are not broadcasted to client: because page is not registered
in EventBus and does not have atmosphere resource assigned.

So maybe my original question should be: how to invode this JS
callback from AtmosphereBehavior.renderHead in ajax requests?

--
Daniel

On Wed, Dec 10, 2014 at 12:19 PM, Daniel Stoch <daniel.stoch@gmail.com> wrote:
> Hi,
>
> It seems that I am using an older version of AtmosphereBehavior which
> implements IResourceListener. Since 6.17.0 this implementation was
> removed and the code is moved to onRequest() method.
> So I must check a newer version, maybe my problem is solved.
>
> Thanks for a tip!
>
> --
> Daniel
>
> On Wed, Dec 10, 2014 at 11:03 AM, Martin Grigorov <mgrigorov@apache.org> wrote:
>> Hi,
>>
>> Please give more details.
>> https://github.com/apache/wicket/blob/master/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereBehavior.java#L51
>> doesn't implement IResourceListener, so it seems you do something custom.
>>
>> Just implementing IResourceListener doesn't mean anything to Wicket.
>> You need to create a callback url with
>> org.apache.wicket.Component#urlFor(org.apache.wicket.RequestListenerInterface,
>> org.apache.wicket.request.mapper.parameter.PageParameters) and use it
>> somehow to invoke org.apache.wicket.IResourceListener#onResourceRequested
>>
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Wed, Dec 10, 2014 at 11:45 AM, Daniel Stoch <daniel.stoch@gmail.com>
>> wrote:
>>
>>> Is it possible to invoke this listener manually, or maybe this is a
>>> generally a bad practise?
>>>
>>> --
>>> Daniel
>>>
>>> > On 9 gru 2014, at 12:24, Daniel Stoch <daniel.stoch@gmail.com> wrote:
>>> >
>>> > Hi,
>>> >
>>> > I have a behavior which implements IResourceListener
>>> > (AtmosphereBehavior). The problem is when this behavior is added to
>>> > page during ajax request (eg. some panel is dynamically added to page)
>>> > - then onResourceRequested is not invoked for page. So when using
>>> > AtmosphereBehavior the suspended connection from the client is not
>>> > registered.
>>> >
>>> > How should I solve this problem: how and when call this
>>> > onResourceRequested method?
>>> >
>>> > --
>>> > Best regards,
>>> > Daniel
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message