There is a problem when setting Gzipfilter in jetty.

I’m trying to set up Jetty to serve compressed html content. In web.xml, I set up GzipFilter and map it to /* but it doesn’t seem to work. This is filtering Configuration:


GZipFilter
Jetty's GZip Filter
Filter that zips all the content on-the-fly
org.mortbay.servlet.GzipFilter

mimeTypes
text/html




GZipFilter
/*

I just started using Jetty, so the solution may be very simple. It might help me if you can link me to , That would be great too.

GZIP compression

GZIP compression can be used to reduce the amount of data sent “over the wire”. Compression is used as a transfer encoding application. This can greatly improve the performance of web applications, but it also consumes more CPU, and certain content (such as images) Cannot compress well.

Static content

Jetty Default Servlet can provide pre-compressed static content as a transfer code, and avoid the cost of real-time compression. If “gzip” init The parameter is set to true, then Jetty will look for compressed static Resources. Therefore, if a request for “foo.txt” is received and the file “foo.txt.gz” exists, then it will be used as “foo.txt” with gzip transfer encoding.

GzipFilter

Jetty Gzip Filter is a compression filter that can be applied to almost any dynamic resource (servlet). It fixes many errors in commonly used compression filters (for example, handling all the ways that content length may be set ), and have been tested with Jetty continuous and pause requests.

Some user agents may be excluded from compression to avoid some common browser errors (yes, this means IE! ).

Refer to jetty doc:
http://docs.codehaus.org/display/JETTY/GZIP+Compression

You can look at the source code of Gzipfilter, here There are many useful comments:
http://download.eclipse.org/jetty/stable-7/xref/org/eclipse/jetty/servlets/GzipFilter.html

I’m trying to set up Jetty to serve compressed html content. In web.xml, I set up GzipFilter and mapped it to /* but this doesn’t seem to work. This is the filter configuration:


GZipFilter
Jetty's GZip Filter< br /> Filter that zips all the content on-the-fly
org.mortbay.servlet.GzipFilter

mimeTypes
text/html




GZipFilter
/*

I just started using Jetty, so the solution may be very simple. If you can link me to a document that may help me, that would be great too .

GZIP compression

GZIP compression can be used to reduce the amount of data sent “over the wire”. Compression is used as a transfer coding application . This can greatly improve the web application Performance, but it also consumes more CPU, and some content (such as images) cannot be compressed well.

Static content

Jetty Default Servlet can Compressed static content is provided as a transfer encoding, and the cost of real-time compression is avoided. If the “gzip” init parameter is set to true, then Jetty will look for compressed static resources. Therefore, if a request for “foo.txt” is received and the file is “Foo.txt.gz” exists, then it will be used as “foo.txt” with gzip transfer encoding.

GzipFilter

Jetty Gzip Filter is a compression filter , Can be applied to almost any dynamic resource (servlet). It fixes many errors in commonly used compression filters (for example, handling all the ways the content length may be set), and has been tested with Jetty continuous and pause requests.

Some user agents may be excluded from compression to avoid some common browser errors (yes, this means IE! ).

Refer to jetty doc:
http://docs.codehaus.org/display/JETTY/GZIP+Compression

You can look at the source code of Gzipfilter, here There are many useful comments:
http://download.eclipse.org/jetty/stable-7/xref/org/eclipse/jetty/servlets/GzipFilter.html

< /p>

Leave a Comment

Your email address will not be published.