Skip to content

Commit

Permalink
Issue #4765 - Review GzipHandler inside ServletContextHandler.
Browse files Browse the repository at this point in the history
Fixed XML files.
Restored ServletContextHandler.setGzipHandler() and
deprecated it in case it's used from user's XML files.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Apr 14, 2020
1 parent e17d0f4 commit 013acca
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,18 @@ public void setServletHandler(ServletHandler servletHandler)
}

/**
* Insert a HandlerWrapper before the first Session,Security or ServletHandler
* @param gzipHandler the GzipHandler for this ServletContextHandler
* @deprecated use {@link #insertHandler(HandlerWrapper)} instead
*/
@Deprecated
public void setGzipHandler(GzipHandler gzipHandler)
{
insertHandler(gzipHandler);
LOG.warn("ServletContextHandler.setGzipHandler(GzipHandler) is deprecated, use insertHandler(HandlerWrapper) instead.");
}

/**
* Insert a HandlerWrapper before the first Session, Security or ServletHandler
* but after any other HandlerWrappers.
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/test-jetty-webapp</Set>
<Set name="war"><Property name="test.webapps" default="." />/test-jetty-webapp.war</Set>
<Set name="gzipHandler">
<New class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
<Set name="minGzipSize">1024</Set>
</New>
</Set>
<Call name="insertHandler">
<Arg>
<New class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
<Set name="minGzipSize">1024</Set>
</New>
</Arg>
</Call>
</New>
</Call>
</Configure>
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/rfc2616-webapp</Set>
<Set name="war"><Property name="test.webapps" default="." />/test-webapp-rfc2616.war</Set>
<Set name="gzipHandler">
<New class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
<Set name="minGzipSize">1024</Set>
</New>
</Set>
<Call name="insertHandler">
<Arg>
<New class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
<Set name="minGzipSize">1024</Set>
</New>
</Arg>
</Call>
</Configure>
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ detected.
<Arg type="Boolean">true</Arg>
</Call>

<Set name="gzipHandler">
<New class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
<Set name="minGzipSize">2048</Set>
</New>
</Set>
<Call name="insertHandler">
<Arg>
<New class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
<Set name="minGzipSize">2048</Set>
</New>
</Arg>
</Call>

<!-- Set Caching Classloader that improves performance on resource searching webapps -->
<!--
Expand Down

0 comments on commit 013acca

Please sign in to comment.