Yea, I didn't expect that this would mess with the event context to be
honest (and I am not sure how it does) but as I was excluding line by line
and managed to find the issue.
Indeed you are correct this belongs to the cometd.

What details are you interested in?

The use case is that a user uses a form to create a new object and this
sends a notification to the header (which is a component in the page).
Header has a notificatoin system in page and it refreshes this.

The code looks something like this

Push relevant code on the page

   @Inject
    private PushManager pushManager;

    //inside a form success method

    pushManager.broadcast(catalogue.format("push.channel.menu_items",
studioAccountUser.getId()), MenuProfile.ProfilePage.SOCIAL);

In the header

  <t:cometd.PushTarget topic="prop:channelMenuItems"
event="updateMenuItems" update="replace" session="true"/>
  <t:block t:id="blockGroupNotificationNumber">
 </t:block>

    @OnEvent("updateMenuItems")
    Block onUpdateMenuItems(ProfilePage profilePage) {
        this.updatedProfilePage = profilePage;
        // Added script for updating menu items badges because of push
notification
        ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
            public void run(JavaScriptSupport jss) {
                jss.addInitializerCall("removeElementById", "menuItemsDiv");
            }
        });
        return blockGroupNotificationNumber;
    }


    public String getChannelMenuItems() {
        return cataloge.format("push.channel.menu_items", user.getId());
    }

Let me know what else would you need from the info...

Thanks

On Sun, Sep 14, 2014 at 8:47 PM, Lance Java <lance.j...@googlemail.com>
wrote:

> Ok, that's a bit of a bombshell you've just dropped there. For those
> playing along at home it seems that you're using tapestry-cometd. Care to
> share how you're using it?
>  On 13 Sep 2014 14:49, "Boris Horvat" <horvat.z.bo...@gmail.com> wrote:
>
> > Ok, so I was able to isolate the problem, but still not sure how to fix
> it
> > :)
> >
> > The form submission creates a new object (a new Shot) and as part of that
> > logic I also brodcast a message. Basically a signal to notify the header
> to
> > refresh a part of itself in order to show an increases in size (think of
> it
> > as a counter). The code is simple
> >
> >     @Inject
> >     private PushManager pushManager;
> >
> >     pushManager.broadcast(catalogue.format("push.channel.menu_items",
> > studioAccountUser.getId()), MenuProfile.ProfilePage.SOCIAL);
> >
> > Lance any ideas why would this cause the issue?
> >
> > When I comment out this line I can see correct event context being passed
> > around
> >
> >
> >    - values = {java.lang.*String*[1]@10926}
> >    - [0] = {java.lang.String@10940}"4"
> >
> > with the line active I see
> >
> >
> >    - values = {java.lang.*Object*[1]@10926}
> >    - [0] = {java.lang.String@10940}"4"
> >
> > Thanks
> >
> > On Sat, Sep 13, 2014 at 3:24 PM, Boris Horvat <horvat.z.bo...@gmail.com>
> > wrote:
> >
> > > From what I can see the fact that context becomes and array of Objects
> in
> > > the end causes the issue, anyone seen something like this before?
> > >
> > > On Sat, Sep 13, 2014 at 3:20 PM, Boris Horvat <
> horvat.z.bo...@gmail.com>
> > > wrote:
> > >
> > >> Hi Lance,
> > >>
> > >> yea it finds the encoder. As previously mentioned the first time I hit
> > >> the url I can see that data is properly set, but after I submit the
> form
> > >> this is broken.
> > >>
> > >> Thiago, by "doesn't" work, I mean the same thing as before. The same
> > >> error.
> > >>
> > >>
> > >>    - org.apache.tapestry5.runtime.ComponentEventException
> > >>    Could not find a coercion from type java.lang.String to type
> > >>    com.thefloorabove.kove.blackbox.domain.project.shot.Scene.
> > >>    context
> > >>       - 4
> > >>    eventTypeactivate
> > >>
> > >> The events happen as this. I first hit the url
> > >> http://localhost:8080/shots/3 all 3 selectedObjects are set (the
> first
> > >> one selectedScene is set based on the context, the other 2 default to
> > some
> > >> object value), then I submit the form and I can see that onActivate is
> > >> properly triggered as the conetxt now contains all 3 objects
> > >>
> > >>
> > >>    - values = {java.lang.String[3]@10890}
> > >>    - [0] = {java.lang.String@10908}"4"
> > >>    - [1] = {java.lang.String@10909}"19"
> > >>    - [2] = {java.lang.String@10910}"88"
> > >>
> > >>
> > >> Following this is the form success event, and then again onActivate
> > event
> > >> is triggered but this time with wrong context
> > >>
> > >>
> > >>    - values = {java.lang.Object[1]@10926}
> > >>    - [0] = {java.lang.String@10940}"4"
> > >>
> > >>  And there we triggered the exception that is shown above
> > >>
> > >> Thanks for all of the help you guys try as I am really confused by
> this
> > >> now :)
> > >>
> > >> On Fri, Sep 12, 2014 at 3:24 PM, Lance Java <
> lance.j...@googlemail.com>
> > >> wrote:
> > >>
> > >>> tapestry-hibernate will only create ValueEncoder's for entities that
> > are
> > >>> in
> > >>> the "basepackage.entities" package (configurable). What packages are
> > your
> > >>> entities in?
> > >>>
> > >>> Try @Inject ValueEncoderSource and call getValueEncoder(Scene.class)
> > >>>
> > >>> Does it find a ValueEncoder?
> > >>>
> > >>
> > >>
> > >>
> > >> --
> > >> Sincerely
> > >> *Boris Horvat*
> > >>
> > >
> > >
> > >
> > > --
> > > Sincerely
> > > *Boris Horvat*
> > >
> >
> >
> >
> > --
> > Sincerely
> > *Boris Horvat*
> >
>



-- 
Sincerely
*Boris Horvat*

Reply via email to