Compression of communication in Rap 2.0 [message #965910] |
Wed, 31 October 2012 15:56  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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 #968512 is a reply to message #968448] |
Fri, 02 November 2012 14:19   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03175 seconds