You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Pouyan Zaxar (JIRA)" <ji...@apache.org> on 2012/07/12 00:13:34 UTC

[jira] [Comment Edited] (WICKET-4651) Null BroadCaster in EventBus

    [ https://issues.apache.org/jira/browse/WICKET-4651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13412062#comment-13412062 ] 

Pouyan Zaxar edited comment on WICKET-4651 at 7/11/12 10:12 PM:
----------------------------------------------------------------

It really depends how Atmosphere is initialized. If I got the code right these are following main alternatives:

1) MeteorServlet: in this case the value of <MAPPING = "org.atmosphere.mapping";> (check ApplicationConfig.java) defined in web.xml is used as AtmospherHanlder's mapping

2) AtmosphereServlet:
In this case you can define various AtmosphereHandler(s) using atmosphere.xml e.g.
<atmosphere-handlers>
  <atmosphere-handler context-root="/twitter" class-name="org.atmosphere.samples.twitter.TwitterAtmosphereHandler"/>
    <property name=”” value=””/>
  <atmosphere-handler .../>
</atmosphere-handlers>
(the context-root is the mapping)

there are also other alternatives but I am really no profi in that matter :) I must also confess that I don't have a very deep understanding of Atmosphere, but If I got it right, each time an AtmosphereHandlerWrapper is created a broadcaster with the mapping of AtmosphereHandler is created and is stored in the wrapper. So I would suggest is to try looking up the root broadcaster (/*) and if not found try to get all broadcasters and find a suitable one.

About the multiple boradcasters: I am also not sure if that would make sense in the context of Wicket (at least not with this implementation), since you have a very robust subscription (with @Subscribe) and filtering mechanism which makes different broadcasters for different AtmosphereResources unnecessary. Event multiple AtmosphereHandlers for different mappings would be superfluous.

A very simple workaround would be to use "public Broadcaster lookup(Class<? extends Broadcaster> c, Object id, boolean createIfNull);" method of default broadcaster factory and set "createIfNull" to true. This way you would make sure that you'd get always a root broadcaster.

                
      was (Author: pausb):
    It really depends how the Atmosphere is initialized. If I got the code right these are following main alternatives:

1) MeteorServlet: in this case the value of <MAPPING = "org.atmosphere.mapping";> (check ApplicationConfig.java) defined in web.xml is used as AtmospherHanlder's mapping

2) AtmosphereServlet:
In this case you can define various AtmosphereHandler(s) using atmosphere.xml e.g.
<atmosphere-handlers>
  <atmosphere-handler context-root="/twitter" class-name="org.atmosphere.samples.twitter.TwitterAtmosphereHandler"/>
    <property name=”” value=””/>
  <atmosphere-handler .../>
</atmosphere-handlers>
(the context-root is the mapping)

there are also other alternatives but I am really no profi in that matter :) I must also confess that I don't have a very deep understanding of Atmosphere, but If I got it right, each time an AtmosphereHandlerWrapper is created a broadcaster with the mapping of AtmosphereHandler is created and is stored in the wrapper. So I would suggest is to try looking up the root broadcaster (/*) and if not found try to get all broadcasters and find a suitable one.

About the multiple boradcasters: I am also not sure if that would make sense in the context of Wicket (at least not with this implementation), since you have a very robust subscription (with @Subscribe) and filtering mechanism which makes different broadcasters for different AtmosphereResources unnecessary. Event multiple AtmosphereHandlers for different mappings would be superfluous.

A very simple workaround would be to use "public Broadcaster lookup(Class<? extends Broadcaster> c, Object id, boolean createIfNull);" method of default broadcaster factory and set "createIfNull" to true. This way you would make sure that you'd get always a root broadcaster.

                  
> Null BroadCaster in EventBus
> ----------------------------
>
>                 Key: WICKET-4651
>                 URL: https://issues.apache.org/jira/browse/WICKET-4651
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-atmosphere
>    Affects Versions: 6.0.0-beta2
>            Reporter: Pouyan Zaxar
>            Assignee: Emond Papegaaij
>            Priority: Blocker
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> Line 85 of EventBus.java tries to fetch broadcaster for mapping "/*", however it returns null if you have configured atmosphere using "org.atmosphere.mapping" to another mapping rather than "/*".
> Having a null broadcaster simply breaks the post method and as a result the whole module.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira