'Wicket.Channel' name is not accessible in ajax related classes
---------------------------------------------------------------

                 Key: WICKET-604
                 URL: https://issues.apache.org/jira/browse/WICKET-604
             Project: Wicket
          Issue Type: Improvement
            Reporter: Peter Ertl
         Attachments: ajax-channel-manager.patch

I am trying to implement a chat client using jetty continuations and a push 
model.

to update the list of chat messages I added an AbstractAjaxTimerBehavior:

IBehavior refresh = new AbstractAjaxTimerBehavior(Duration.milliseconds(250)) 
// repeat again and again
{
  @Override
  protected void onTimer(AjaxRequestTarget target)
  {
     // update messages
  }
}

actually this timer behavior will continuously create XmlHtttpRequests to 
update the list. the requests will be paused using jetty continuations and 
return on events or eventually time out and restart instantly. so you get 
immediate updates without wasting resources on the server.

AbstractAjaxTimerBehavior will call

  return getCallbackScript("wicketAjaxGet('" + 
getCallbackUrl(onlyTargetActivePage()) + "'", null, null, precondition);

to generate an wicketAjaxGet call.

unfortunately, when adding another ajax component for submitting messages the 
following will be shown in ajax debug window when clicking on 'SendMessage' 
while the refresh request is active:

 [ INFO: Channel busy - postponing... ]

this is because SubmitMessage and AbstractAjaxTimerBehavior use the same 
Wicket.Channel. the default channel is of type queue so request will be 
serialized.

So, in order to have to different, concurrently running XmlHttpRequest's you 
would need access to the channel name.

I would suggest to add the following method to AbstractDefaultAjaxBehavior:

  protected CharSequence getCallbackScript(final CharSequence partialCall, 
    final CharSequence onSuccessScript, final CharSequence onFailureScript, 
    final CharSequence precondition, CharSequence channel);

I attached a patch as an suggestion on how to do this...

I did a local test of this patch and everything works as a charm now...

This would be great for any push model ajax stuff to have....

Also, it makes no sense to permit access to the wonderful Wicket.ChannelManager 
functionality :-)


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to