Good evening,

So, I've tried what you said. I forgot one JS file in my initial attempt
but, even with this configuration I have now a different symptom. But it
still doesn't work. For now, the problem is that I have an empty
ajax-response!

Here is my code for the filter:

public class ResponseSizeFilter implements PerRequestBroadcastFilter
{
    @Override
    public BroadcastAction filter(final AtmosphereResource r, final Object
originalMessage,
            final Object message)
    {
        final AtmosphereRequest request = r.getRequest();
        if
("true".equalsIgnoreCase(request.getHeader(HeaderConfig.X_ATMOSPHERE_TRACKMESSAGESIZE)))
        {
            final String msg = message.toString();
            return new BroadcastAction(BroadcastAction.ACTION.CONTINUE,
msg.length()
                    + "\r\n".length() + "|");
        }
        return new BroadcastAction(BroadcastAction.ACTION.CONTINUE,
message);
    }

    @Override
    public BroadcastAction filter(final Object originalMessage, final
Object message)
    {
        final String msg = message.toString();
        return new BroadcastAction(BroadcastAction.ACTION.CONTINUE,
message);
    }
}

I can see in my logs that it's called.

But whether I call the server-side by:

Wicket.Ajax.get({"u": "${url}", "e": "click", "c" : "blah"})

or by:

jQuery('blah').wicketAtmosphere({"url" : "${url}" });

It fails to update my component because the response is:

<?xml version="1.0" encoding="UTF-8"?><ajax-response></ajax-response>



The strange thing being that in my Filter, the message really contains the
right (non-empty) <ajax-response>!

Here is the Ajax / WebSocket managing code (it's in an
AbstractDefaultAjaxBehavior):

    @Override
    protected void respond(final AjaxRequestTarget target)
    {
        final CometChannel chan = new CometChannel(isTapped()));
        Application.get().getEventBus().post(chan);
    }

    @Subscribe
    public void rotate(final AjaxRequestTarget target, final CometChannel
event)
    {
        if (event.isTapped())
        {
            target.appendJavaScript("jQuery('#card" + event.getUuid() +
"').rotate(90);");
        }
        else
        {
            target.appendJavaScript("jQuery('#card" + event.getUuid() +
"').rotate(0);");
        }
    }

I thought that maybe the empty <ajax-response> came from the respond()
method not adding anything to the AjaxRequestTarget but in the examples
from Wicket GitHub, it's done like that for the chat message. So I ran out
of solutions.

As a side-note, this not the same code as in the original message, but the
symptom in this Comet channel is the same as here. The only difference
being that in this other channel, the message to broadcast is quite long,
hence the need for the BroadcastFilter.

So, is the idea of filing a Jira issue still valid?

Sorry for that long message. And thanks in advance for any help.

Regards,

Pierre Goupil

--
Le bonheur n'est pas une destination, mais une façon de voyager.

Papa d'une petite Lou-Ann depuis le 30 juin.

Reply via email to