Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Compression of communication in Rap 2.0(Compression with GzipFilter under Rap 2.0 possible)
Compression of communication in Rap 2.0 [message #965910] Wed, 31 October 2012 15:56 Go to next message
Sebastian von Klinski is currently offline Sebastian von KlinskiFriend
Messages: 12
Registered: October 2012
Junior Member
Under rap 1.4 it was possible to compress the communication with the org.mortbay.servlet.GzipFilter by adding a filter extension

<extension
point="org.eclipse.equinox.http.registry.filters">
<filter
alias="/"
class="org.mortbay.servlet.GzipFilter"
httpcontextId="org.eclipse.rap.httpcontext"
load-on-startup="true">
</filter>
</extension>

This compression dramatically accelerated the communication and thus improved the GUI performance.

Under Rap 2.0 the jetty version 8.1.3 is used. There, the GZipFilter has been moved to the jetty.servlets package, which is no default plugin of eclipse. I added the respective jar files from the eclipse jetty 8.1.5 distribution (jetty-distribution-8.1.5.v20120716.zip).

However, rap always crashes when a http filter is added with the new GzipFilter.

Can anybody tell me, how it is possible to compress the JSON-Messages under Rap 2.0?

Thanks in advance,

Sebastian
Re: Compression of communication in Rap 2.0 [message #968137 is a reply to message #965910] Fri, 02 November 2012 08:07 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Sebastian,
currently, client can't handle compressed JSON. Please file an
enhancement request about this issue.
Thanks,
Ivan

On 10/31/2012 6:17 PM, Sebastian von Klinski wrote:
> Under rap 1.4 it was possible to compress the communication with the
> org.mortbay.servlet.GzipFilter by adding a filter extension
>
> <extension
> point="org.eclipse.equinox.http.registry.filters">
> <filter
> alias="/"
> class="org.mortbay.servlet.GzipFilter"
> httpcontextId="org.eclipse.rap.httpcontext"
> load-on-startup="true">
> </filter>
> </extension>
>
> This compression dramatically accelerated the communication and thus
> improved the GUI performance.
>
> Under Rap 2.0 the jetty version 8.1.3 is used. There, the GZipFilter
> has been moved to the jetty.servlets package, which is no default
> plugin of eclipse. I added the respective jar files from the eclipse
> jetty 8.1.5 distribution (jetty-distribution-8.1.5.v20120716.zip).
>
> However, rap always crashes when a http filter is added with the new
> GzipFilter.
>
> Can anybody tell me, how it is possible to compress the JSON-Messages
> under Rap 2.0?
>
> Thanks in advance,
>
> Sebastian

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Compression of communication in Rap 2.0 [message #968448 is a reply to message #968137] Fri, 02 November 2012 13:20 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

Ivan,

GZip compression should be handled transparently by the browser. Is there some reason why the RAP client doesn't support it? It seems like the problem is likely on the server-side.

Cole
Re: Compression of communication in Rap 2.0 [message #968468 is a reply to message #968448] Fri, 02 November 2012 13:34 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Sorry... my bad. The compression works fine in RAP 2.0. Just checked it
with our online Controls Demo.
[1] http://rap.eclipsesource.com/controlsdemo/controls
Best,
Ivan

On 11/2/2012 3:20 PM, Cole Markham wrote:
> Ivan,
>
> GZip compression should be handled transparently by the browser. Is
> there some reason why the RAP client doesn't support it? It seems like
> the problem is likely on the server-side.
>
> Cole

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Compression of communication in Rap 2.0 [message #968476 is a reply to message #968137] Fri, 02 November 2012 13:39 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

On 11/02/2012 09:07 AM, Ivan Furnadjiev wrote:
> currently, client can't handle compressed JSON.

No, gzip compression is handled transparently to the client code by the
browser. RAP works fine with gzip compression, as you can see in our
online examples [1].

Sebastian, could you compare the HTTP headers with those created by your
Jetty configuration? In doubt, you should ask for advice on one of the
Jetty channels [2].

Regards,
Ralf

[1] http://rap.eclipsesource.com/rapdemo/examples
[2] http://www.eclipse.org/projects/project.php?id=rt.jetty

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Compression of communication in Rap 2.0 [message #968512 is a reply to message #968448] Fri, 02 November 2012 14:19 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

Sebastian,

I use Apache as a front-end for my RAP application and let it handle gzip compression using mod_deflate. The only thing I had to add to the default config is to have it compress "application/json". I am using RAP 1.5, but it uses the JSON protocol as well so it should be similar to 2.0. Below is the configuration for mod_deflate. I am running Ubuntu Linux, so this is in /etc/apache2/mods-available/deflate.conf, be sure to enable the module as well. I confirmed with the Chrome web inspector that json requests are using gzip compression and tested with IE9 as well.

<IfModule mod_deflate.c>
          # these are known to be safe with MSIE 6
          AddOutputFilterByType DEFLATE text/html text/plain text/xml

          # everything else may cause problems with MSIE 6
          AddOutputFilterByType DEFLATE text/css
          AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript application/json
          AddOutputFilterByType DEFLATE application/rss+xml
</IfModule>


If it works with Apache then it should work with Jetty as well, but I'm not sure how to configure Jetty properly. It may be that you need to configure the filter to only compress certain types of content as done with Apache.

Hope that helps,

Cole
Re: Compression of communication in Rap 2.0 [message #972208 is a reply to message #968476] Mon, 05 November 2012 12:48 Go to previous messageGo to next message
Sebastian von Klinski is currently offline Sebastian von KlinskiFriend
Messages: 12
Registered: October 2012
Junior Member
Hi Ralf,

I compared the http headers. With rap 1.4 the header specifies as the Content-Encoding gzip:

Content-Encoding gzip
Content-Type text/javascript; charset=UTF-8
Server Jetty(6.1.x)
Transfer-Encoding chunked

With rap 2.0 this field Content-Encoding is missing:

Content-Length 53
Content-Type application/json;charset=UTF-8
Server Jetty(8.1.3.v20120522)

In both applications I set the runtime argument -Dorg.eclipse.rwt.compression=true. This argument was a hint I have seen in several posts. But this runtime argument has apparently no effect, even for rap 1.4. As long as I do not specify the GzipFiler for the extension point "org.eclipse.equinox.http.registry.filters", no compression is applied, also for Rap 1.4.

So, is my runtime argument wrong in the first place? How could I turn on jetty compression when I run rap from within the eclipse IDE?

Thanks in advance,

Sebastian

Re: Compression of communication in Rap 2.0 [message #972386 is a reply to message #972208] Mon, 05 November 2012 15:32 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Sebastian,

yes, this parameter is outdated as of 1.4. There are some pitfalls
related to compressing responses, so we decided to leave this task to
the servlet containers. For more details, see [1].

Regards, Ralf


[1] 342242: Consider to remove the ability to compress responses from RWT
https://bugs.eclipse.org/bugs/show_bug.cgi?id=342242

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Menu&MenuItem
Next Topic:Non working url in browser widget
Goto Forum:
  


Current Time: Fri Apr 19 21:36:16 GMT 2024

Powered by FUDForum. Page generated in 0.03244 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top