Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 6.0.0-beta2
    • Fix Version/s: 6.0.0
    • Component/s: wicket-atmosphere
    • Labels:
      None

      Description

      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.

        Activity

        Hide
        papegaaij Emond Papegaaij added a comment -

        I agree that the current approach is not very flexible. What do you suggest to change this to? Should I use BroadcasterFactory.lookupAll and simply take the first or should I make the id (mapping) configurable? Do you think it makes sense to allow multiple broadcasters?

        Show
        papegaaij Emond Papegaaij added a comment - I agree that the current approach is not very flexible. What do you suggest to change this to? Should I use BroadcasterFactory.lookupAll and simply take the first or should I make the id (mapping) configurable? Do you think it makes sense to allow multiple broadcasters?
        Hide
        pausb Pouyan Zaxar added a comment - - edited

        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 (and also the corresponding broadcaster message)

        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.

        Show
        pausb Pouyan Zaxar added a comment - - edited 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 (and also the corresponding broadcaster message) 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.
        Hide
        papegaaij Emond Papegaaij added a comment -

        I've changed EventBus to use the first broadcaster returned by BroadcasterFactory by default, but you can also specify your own broadcaster.

        Show
        papegaaij Emond Papegaaij added a comment - I've changed EventBus to use the first broadcaster returned by BroadcasterFactory by default, but you can also specify your own broadcaster.
        Hide
        pausb Pouyan Zaxar added a comment -

        Did you add the changes to SNAPSHOT?

        Show
        pausb Pouyan Zaxar added a comment - Did you add the changes to SNAPSHOT?
        Hide
        papegaaij Emond Papegaaij added a comment -

        SNAPSHOTs are built automatically. It could take a day before caching repositories get updated though.

        Show
        papegaaij Emond Papegaaij added a comment - SNAPSHOTs are built automatically. It could take a day before caching repositories get updated though.

          People

          • Assignee:
            papegaaij Emond Papegaaij
            Reporter:
            pausb Pouyan Zaxar
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1m
              1m
              Remaining:
              Remaining Estimate - 1m
              1m
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development