Merge pull request #10755 from jetty/jetty-10.0.x-pushCacheFilter

deprecate PushCacheFilter
This commit is contained in:
Lachlan 2023-10-25 16:32:32 +11:00 committed by GitHub
commit 6e7fafaf85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 18 deletions

View File

@ -18,16 +18,6 @@
<listener-class>com.acme.TestListener</listener-class>
</listener>
<filter>
<filter-name>PushFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.PushCacheFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>PushFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>QoSFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.QoSFilter</filter-class>

View File

@ -53,7 +53,6 @@ import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlets.PushCacheFilter;
import org.eclipse.jetty.util.resource.PathResource;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.slf4j.LoggerFactory;
@ -78,8 +77,6 @@ public class Http2Server
throw new FileNotFoundException(docroot.toString());
context.setBaseResource(new PathResource(docroot));
context.addFilter(PushCacheFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
// context.addFilter(PushSessionCacheFilter.class,"/*",EnumSet.of(DispatcherType.REQUEST));
context.addFilter(PushedTilesFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
context.addServlet(new ServletHolder(servlet), "/test/*");
context.addServlet(DefaultServlet.class, "/").setInitParameter("maxCacheSize", "81920");

View File

@ -69,7 +69,6 @@ $ cd demo-base/
2017-09-20 16:23:04.306:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@371a67ec{/async-rest,[file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-async-rest.war-_async-rest-any-5319296087878801290.dir/webapp/, jar:file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-async-rest.war-_async-rest-any-5319296087878801290.dir/webapp/WEB-INF/lib/example-async-rest-jar-{VERSION}.jar!/META-INF/resources],AVAILABLE}{/async-rest.war}
2017-09-20 16:23:04.429:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=53ms
2017-09-20 16:23:04.432:WARN::main: test webapp is deployed. DO NOT USE IN PRODUCTION!
2017-09-20 16:23:04.511:INFO:oejsh.ManagedAttributeListener:main: update PushFilter null->org.eclipse.jetty.servlets.PushCacheFilter@2362f559 on o.e.j.w.WebAppContext@35e2d654{/test,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test.war-_test-any-6279588879522983394.dir/webapp/,STARTING}{/test.war}
2017-09-20 16:23:04.516:INFO:oejsh.ManagedAttributeListener:main: update QoSFilter null->org.eclipse.jetty.servlets.QoSFilter@7770f470 on o.e.j.w.WebAppContext@35e2d654{/test,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test.war-_test-any-6279588879522983394.dir/webapp/,STARTING}{/test.war}
2017-09-20 16:23:04.519:WARN:oeju.DeprecationWarning:main: Using @Deprecated Class org.eclipse.jetty.servlets.MultiPartFilter
2017-09-20 16:23:04.549:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@35e2d654{/test,file:///private/var/folders/h6/yb_lbnnn11g0y1jjlvqg631h0000gn/T/jetty-0.0.0.0-8080-test.war-_test-any-6279588879522983394.dir/webapp/,AVAILABLE}{/test.war}

View File

@ -14,7 +14,7 @@
[[http2-configuring-push]]
=== Configuring HTTP/2 Push
HTTP/2 Push is a mechanism that allows the server to send multiple resources to the client for a single client request.
HTTP/2 Push is a spec deprecated mechanism that allows the server to send multiple resources to the client for a single client request.
This will reduce the amount of round-trips necessary to retrieve all the resources that make up a web page and can significantly improve the page load time.
HTTP/2 Push can be automated in your application by configuring a link:{JDURL}/org/eclipse/jetty/servlets/PushCacheFilter.html[`PushCacheFilter`] in the `web.xml`, in this way:

View File

@ -51,6 +51,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @deprecated no replacement for this deprecated http feature (will be removed in Jetty 12)
*/
@Deprecated
public class PushCacheFilterTest extends AbstractTest
{
private String contextPath = "/push";

View File

@ -2,8 +2,9 @@
[description]
Adds Jetty utility servlets and filters available to a webapp.
Puts org.eclipse.jetty.servlets on the server classpath (CGI, CrossOriginFilter, DosFilter,
MultiPartFilter, PushCacheFilter, QoSFilter, etc.) for use by all webapplications.
Puts org.eclipse.jetty.servlets on the server classpath
(CrossOriginFilter, DosFilter, MultiPartFilter, QoSFilter, etc.)
for use by all web applications.
[depend]
servlet

View File

@ -22,7 +22,7 @@ module org.eclipse.jetty.servlets
// Only required if using CloseableDoSFilter.
requires static org.eclipse.jetty.io;
// Only required if using DoSFilter, PushCacheFilter, etc.
// Only required if using DoSFilter, IncludeExcludeBasedFilter, etc.
requires static org.eclipse.jetty.http;
requires static org.eclipse.jetty.server;
// Only required if using CrossOriginFilter, DoSFilter, etc.

View File

@ -66,7 +66,9 @@ import org.slf4j.LoggerFactory;
* cache.</p>
* <p>If the init param useQueryInKey is set, then the query string is used as
* as part of the key to identify a resource</p>
* @deprecated no replacement for this deprecated http feature (will be removed in Jetty 12)
*/
@Deprecated
@ManagedObject("Push cache based on the HTTP 'Referer' header")
public class PushCacheFilter implements Filter
{
@ -80,6 +82,11 @@ public class PushCacheFilter implements Filter
private long _renew = NanoTime.now();
private boolean _useQueryInKey;
public PushCacheFilter()
{
LOG.warn(PushCacheFilter.class.getSimpleName() + " is an example class not suitable for production.");
}
@Override
public void init(FilterConfig config) throws ServletException
{