Filters executed before Serializers? Problem with JavascriptClientFilter when using Serializers

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Filters executed before Serializers? Problem with JavascriptClientFilter when using Serializers

ghillert
Hi,

I have a question and potentially an issue with using the
JavascriptClientFilter (which is in my understanding required to make
things work in IE and Opera).

I am working on an adapter for Spring Integration and Spring
Integration provides several converters that will transform your
messages to the final HTTP response format, e.g. Json (using Jackson).
Therefore for the Atmosphere integration piece, I want to use
Atmosphere's Serializer interface (org.atmosphere.cpr.Serializer) and
hook into its serialization facility (e.g. passing Java Objects in and
serializing them as JSON).

I think I can make that work, but here seem to be the problem. I had
created a simpler Spring MVC example and after adding the
"JavascriptClientFilter", my example started working in IE8. However,
I seem to have a hard time getting my Spring Integration example to
work in IE until I looked at the JavascriptClientFilter sources.

It looks to me that Serializers are executed AFTER Filters - If that
is the case it would render the JavascriptClientFilter or the
Serializer useless as the JavascriptClientFilter expects a String
message...

Is there any way I can work around this? Is this maybe a good use-case
for filters that apply post serialization?

Thanks for the help!

Regards,

Gunnar
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filters executed before Serializers? Problem with JavascriptClientFilter when using Serializers

Jeanfrancois Arcand-4
Salut,

On 11-07-01 11:22 AM, Gunnar Hillert wrote:

> Hi,
>
> I have a question and potentially an issue with using the
> JavascriptClientFilter (which is in my understanding required to make
> things work in IE and Opera).
>
> I am working on an adapter for Spring Integration and Spring
> Integration provides several converters that will transform your
> messages to the final HTTP response format, e.g. Json (using Jackson).
> Therefore for the Atmosphere integration piece, I want to use
> Atmosphere's Serializer interface (org.atmosphere.cpr.Serializer) and
> hook into its serialization facility (e.g. passing Java Objects in and
> serializing them as JSON).
>
> I think I can make that work, but here seem to be the problem. I had
> created a simpler Spring MVC example and after adding the
> "JavascriptClientFilter", my example started working in IE8. However,
> I seem to have a hard time getting my Spring Integration example to
> work in IE until I looked at the JavascriptClientFilter sources.
>
> It looks to me that Serializers are executed AFTER Filters - If that
> is the case it would render the JavascriptClientFilter or the
> Serializer useless as the JavascriptClientFilter expects a String
> message...
>
> Is there any way I can work around this? Is this maybe a good use-case
> for filters that apply post serialization?

You are right with your observation. You can probably implement
something inside AtmosphereHandler#onStateChange (take a look at the
AbstractAtmosphereHandler source). You probably have to "manually" add
the IE code after the serializer call.

But can you file an RFE about post serialize Filter? I can work on that
for sure in 0.8

A+

-- Jeanfrancois


>
> Thanks for the help!
>
> Regards,
>
> Gunnar
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filters executed before Serializers? Problem with JavascriptClientFilter when using Serializers

ghillert
Thanks - will create a Jira in a little while. Quick question though -
what is the slight difference in the JavaScript added in -

public BroadcastAction filter(Object originalMessage, Object message) {...}
and
public BroadcastAction filter(HttpServletRequest request,
HttpServletResponse response, Object message) {...}

Cheers,

Gunnar

On Fri, Jul 1, 2011 at 8:47 PM, jfarcand <[hidden email]> wrote:

> Salut,
>
> On 11-07-01 11:22 AM, Gunnar Hillert wrote:
>>
>> Hi,
>>
>> I have a question and potentially an issue with using the
>> JavascriptClientFilter (which is in my understanding required to make
>> things work in IE and Opera).
>>
>> I am working on an adapter for Spring Integration and Spring
>> Integration provides several converters that will transform your
>> messages to the final HTTP response format, e.g. Json (using Jackson).
>> Therefore for the Atmosphere integration piece, I want to use
>> Atmosphere's Serializer interface (org.atmosphere.cpr.Serializer) and
>> hook into its serialization facility (e.g. passing Java Objects in and
>> serializing them as JSON).
>>
>> I think I can make that work, but here seem to be the problem. I had
>> created a simpler Spring MVC example and after adding the
>> "JavascriptClientFilter", my example started working in IE8. However,
>> I seem to have a hard time getting my Spring Integration example to
>> work in IE until I looked at the JavascriptClientFilter sources.
>>
>> It looks to me that Serializers are executed AFTER Filters - If that
>> is the case it would render the JavascriptClientFilter or the
>> Serializer useless as the JavascriptClientFilter expects a String
>> message...
>>
>> Is there any way I can work around this? Is this maybe a good use-case
>> for filters that apply post serialization?
>
> You are right with your observation. You can probably implement something
> inside AtmosphereHandler#onStateChange (take a look at the
> AbstractAtmosphereHandler source). You probably have to "manually" add the
> IE code after the serializer call.
>
> But can you file an RFE about post serialize Filter? I can work on that for
> sure in 0.8
>
> A+
>
> -- Jeanfrancois
>
>
>>
>> Thanks for the help!
>>
>> Regards,
>>
>> Gunnar
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filters executed before Serializers? Problem with JavascriptClientFilter when using Serializers

Jeanfrancois Arcand-4
Salut,

On 11-07-01 10:18 PM, Gunnar Hillert wrote:
> Thanks - will create a Jira in a little while. Quick question though -
> what is the slight difference in the JavaScript added in -
>
> public BroadcastAction filter(Object originalMessage, Object message) {...}
> and
> public BroadcastAction filter(HttpServletRequest request,
> HttpServletResponse response, Object message) {...}

The first apply to all requests, the second apply to single request.
That's how we can customize the behavior "per browser".

A+

-- Jeanfrancois

>
> Cheers,
>
> Gunnar
>
> On Fri, Jul 1, 2011 at 8:47 PM, jfarcand<[hidden email]>  wrote:
>> Salut,
>>
>> On 11-07-01 11:22 AM, Gunnar Hillert wrote:
>>>
>>> Hi,
>>>
>>> I have a question and potentially an issue with using the
>>> JavascriptClientFilter (which is in my understanding required to make
>>> things work in IE and Opera).
>>>
>>> I am working on an adapter for Spring Integration and Spring
>>> Integration provides several converters that will transform your
>>> messages to the final HTTP response format, e.g. Json (using Jackson).
>>> Therefore for the Atmosphere integration piece, I want to use
>>> Atmosphere's Serializer interface (org.atmosphere.cpr.Serializer) and
>>> hook into its serialization facility (e.g. passing Java Objects in and
>>> serializing them as JSON).
>>>
>>> I think I can make that work, but here seem to be the problem. I had
>>> created a simpler Spring MVC example and after adding the
>>> "JavascriptClientFilter", my example started working in IE8. However,
>>> I seem to have a hard time getting my Spring Integration example to
>>> work in IE until I looked at the JavascriptClientFilter sources.
>>>
>>> It looks to me that Serializers are executed AFTER Filters - If that
>>> is the case it would render the JavascriptClientFilter or the
>>> Serializer useless as the JavascriptClientFilter expects a String
>>> message...
>>>
>>> Is there any way I can work around this? Is this maybe a good use-case
>>> for filters that apply post serialization?
>>
>> You are right with your observation. You can probably implement something
>> inside AtmosphereHandler#onStateChange (take a look at the
>> AbstractAtmosphereHandler source). You probably have to "manually" add the
>> IE code after the serializer call.
>>
>> But can you file an RFE about post serialize Filter? I can work on that for
>> sure in 0.8
>>
>> A+
>>
>> -- Jeanfrancois
>>
>>
>>>
>>> Thanks for the help!
>>>
>>> Regards,
>>>
>>> Gunnar
>>>
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filters executed before Serializers? Problem with JavascriptClientFilter when using Serializers

ghillert
Thanks for the clarification.

I just filed the Jira: http://java.net/jira/browse/ATMOSPHERE-141

Cheers,

Gunnar
Loading...