6 Replies Latest reply on Jun 7, 2014 11:01 AM by garcia-jj

    GZIP Encoding with Alpha 4?

    drbawb

      I saw that `undertow` seems to have recently added support for GZip Encoding.

       

      Is it possible to enable GZip encoding for an http-listener or server in Wildfly yet?

        • 1. Re: GZIP Encoding with Alpha 4?
          ctomc

          Hi,

           

          not yet, can you create issue for that in WildFly - JBoss Issue Tracker so we don't forget about it.

           

          --

          tomaz

          • 2. Re: GZIP Encoding with Alpha 4?
            swd847

            For now is possible to do this programatically via an Undertow io.undertow.servlet.ServletExtension. Just create an extension (and the META-INF/services file to go with it), and in the extension add the GZip encoding handler via the handler wrappers mechanism.

             

            As Tomaz says, it will be possible to do this directly via config at some point.

            • 3. Re: GZIP Encoding with Alpha 4?
              garcia-jj

              There are way to configure gzip from now?

              • 4. Re: GZIP Encoding with Alpha 4?
                ctomc
                • 5. Re: GZIP Encoding with Alpha 4?
                  rumianom

                  Hi,

                   

                  in WildFly 8.0.0.Final you can use gzip encoding, here is an example:

                   

                  <subsystem xmlns="urn:jboss:domain:undertow:1.0">

                              <buffer-caches>

                                  <buffer-cache name="default" buffer-size="1024" buffers-per-region="1024" max-regions="10"/>

                              </buffer-caches>

                              <server name="default-server">

                                  <http-listener name="default" socket-binding="http"/>

                                  <host name="default-host" alias="localhost">

                                      <location name="/" handler="welcome-content" />

                                      <filter-ref name="gzipFilter" predicate="path-suffix['.css'] or path-suffix['.js']" />

                                      <filter-ref name="server-header"/>

                                      <filter-ref name="x-powered-by-header"/>

                                  </host>

                              </server>

                              <servlet-container name="default" default-buffer-cache="default" stack-trace-on-error="local-only">

                                  <jsp-config/>

                              </servlet-container>

                              <handlers>

                                  <file name="welcome-content" path="${jboss.home.dir}/welcome-content" directory-listing="true"/>

                              </handlers>

                              <filters>

                                  <response-header name="server-header" header-name="Server" header-value="Wildfly 8"/>

                                  <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow 1"/>

                                  <gzip name="gzipFilter"/>

                              </filters>

                          </subsystem>

                   

                  I hope it helps other people looking for an example usage

                   

                  ----------------------------

                  Maciej

                  P.S.: I have described it also on my blog http://rumianom.pl/rumianom/entry/gzip_content_encoding_in_wildfly

                  • 6. Re: GZIP Encoding with Alpha 4?
                    garcia-jj

                    Maciej, thank you very much. I've added your blog to my bookmarks.

                     

                    Best regards