From a7a9ccce35981925c6375ef01d06440a849d44e0 Mon Sep 17 00:00:00 2001
From: Lachlan Roberts
Date: Thu, 19 Oct 2023 13:15:47 +1100
Subject: [PATCH 1/4] deprecate PushCacheFilter
Signed-off-by: Lachlan Roberts
---
.../java/org/eclipse/jetty/servlets/PushCacheFilter.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushCacheFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushCacheFilter.java
index 39ba36c082c9..e3da0619a1ac 100644
--- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushCacheFilter.java
+++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushCacheFilter.java
@@ -66,7 +66,9 @@
* cache.
* If the init param useQueryInKey is set, then the query string is used as
* as part of the key to identify a resource
+ * @deprecated no replacement for this deprecated http feature
*/
+@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
{
From a4b15b1a81295a4abeea119ca1ff427a51d72b3d Mon Sep 17 00:00:00 2001
From: Lachlan Roberts
Date: Thu, 19 Oct 2023 19:57:48 +1100
Subject: [PATCH 2/4] remove use of PushCacheFilter from Http2Server demo
Signed-off-by: Lachlan Roberts
---
.../src/main/java/org/eclipse/jetty/demos/Http2Server.java | 3 ---
1 file changed, 3 deletions(-)
diff --git a/demos/embedded/src/main/java/org/eclipse/jetty/demos/Http2Server.java b/demos/embedded/src/main/java/org/eclipse/jetty/demos/Http2Server.java
index 4c173a5968a2..7c841dff409a 100644
--- a/demos/embedded/src/main/java/org/eclipse/jetty/demos/Http2Server.java
+++ b/demos/embedded/src/main/java/org/eclipse/jetty/demos/Http2Server.java
@@ -53,7 +53,6 @@
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 static void main(String... args) throws Exception
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");
From 36d3377c235fdcd635d78acd639e11058b67a1ee Mon Sep 17 00:00:00 2001
From: Lachlan Roberts
Date: Tue, 24 Oct 2023 11:15:28 +1100
Subject: [PATCH 3/4] remove usage of PushCacheFilter from demo-jetty-webapp
Signed-off-by: Lachlan Roberts
---
.../demo-jetty-webapp/src/main/webapp/WEB-INF/web.xml | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/demos/demo-jetty-webapp/src/main/webapp/WEB-INF/web.xml b/demos/demo-jetty-webapp/src/main/webapp/WEB-INF/web.xml
index b610408e0dac..01f439c69ac7 100644
--- a/demos/demo-jetty-webapp/src/main/webapp/WEB-INF/web.xml
+++ b/demos/demo-jetty-webapp/src/main/webapp/WEB-INF/web.xml
@@ -18,16 +18,6 @@
com.acme.TestListener
-
- PushFilter
- org.eclipse.jetty.servlets.PushCacheFilter
- true
-
-
- PushFilter
- /*
-
-
QoSFilter
org.eclipse.jetty.servlets.QoSFilter
From 8587cc9bef60b1546ec148b0e6a9a10be9a8f436 Mon Sep 17 00:00:00 2001
From: Joakim Erdfelt
Date: Tue, 24 Oct 2023 09:34:48 -0500
Subject: [PATCH 4/4] More PushCacheFilter deprecation cleanup
Signed-off-by: Joakim Erdfelt
---
.../gettingstarted/getting-started/jetty-running.adoc | 1 -
.../src/main/asciidoc/old_docs/http2/configuring-push.adoc | 2 +-
.../org/eclipse/jetty/http2/client/PushCacheFilterTest.java | 4 ++++
jetty-servlets/src/main/config/modules/servlets.mod | 5 +++--
jetty-servlets/src/main/java/module-info.java | 2 +-
.../java/org/eclipse/jetty/servlets/PushCacheFilter.java | 2 +-
6 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/documentation/jetty-documentation/src/main/asciidoc/old_docs/gettingstarted/getting-started/jetty-running.adoc b/documentation/jetty-documentation/src/main/asciidoc/old_docs/gettingstarted/getting-started/jetty-running.adoc
index c67eb93d2319..11da3b7bccba 100644
--- a/documentation/jetty-documentation/src/main/asciidoc/old_docs/gettingstarted/getting-started/jetty-running.adoc
+++ b/documentation/jetty-documentation/src/main/asciidoc/old_docs/gettingstarted/getting-started/jetty-running.adoc
@@ -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}
diff --git a/documentation/jetty-documentation/src/main/asciidoc/old_docs/http2/configuring-push.adoc b/documentation/jetty-documentation/src/main/asciidoc/old_docs/http2/configuring-push.adoc
index d0611d36e3a2..a7d6824c0865 100644
--- a/documentation/jetty-documentation/src/main/asciidoc/old_docs/http2/configuring-push.adoc
+++ b/documentation/jetty-documentation/src/main/asciidoc/old_docs/http2/configuring-push.adoc
@@ -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:
diff --git a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/PushCacheFilterTest.java b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/PushCacheFilterTest.java
index 757783fa441a..475c2c20bfac 100644
--- a/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/PushCacheFilterTest.java
+++ b/jetty-http2/http2-client/src/test/java/org/eclipse/jetty/http2/client/PushCacheFilterTest.java
@@ -51,6 +51,10 @@
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";
diff --git a/jetty-servlets/src/main/config/modules/servlets.mod b/jetty-servlets/src/main/config/modules/servlets.mod
index dee4a8aa5d24..fece222da3b9 100644
--- a/jetty-servlets/src/main/config/modules/servlets.mod
+++ b/jetty-servlets/src/main/config/modules/servlets.mod
@@ -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
diff --git a/jetty-servlets/src/main/java/module-info.java b/jetty-servlets/src/main/java/module-info.java
index 06956bb29cf8..95152f6fdbec 100644
--- a/jetty-servlets/src/main/java/module-info.java
+++ b/jetty-servlets/src/main/java/module-info.java
@@ -22,7 +22,7 @@
// 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.
diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushCacheFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushCacheFilter.java
index e3da0619a1ac..d80e10207790 100644
--- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushCacheFilter.java
+++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushCacheFilter.java
@@ -66,7 +66,7 @@
* cache.
* If the init param useQueryInKey is set, then the query string is used as
* as part of the key to identify a resource
- * @deprecated no replacement for this deprecated http feature
+ * @deprecated no replacement for this deprecated http feature (will be removed in Jetty 12)
*/
@Deprecated
@ManagedObject("Push cache based on the HTTP 'Referer' header")