Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jetty-servlets')
-rw-r--r--jetty-servlets/pom.xml2
-rw-r--r--jetty-servlets/src/main/config/modules/servlets.mod9
-rw-r--r--jetty-servlets/src/main/java/org/eclipse/jetty/servlets/PushCacheFilter.java19
-rw-r--r--jetty-servlets/src/test/java/org/eclipse/jetty/servlets/ThreadStarvationTest.java5
4 files changed, 19 insertions, 16 deletions
diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml
index ef38677ae4..00dada9234 100644
--- a/jetty-servlets/pom.xml
+++ b/jetty-servlets/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>jetty-project</artifactId>
<groupId>org.eclipse.jetty</groupId>
- <version>9.3.7-SNAPSHOT</version>
+ <version>9.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-servlets</artifactId>
diff --git a/jetty-servlets/src/main/config/modules/servlets.mod b/jetty-servlets/src/main/config/modules/servlets.mod
index 2e977c05f1..5e1c84fc27 100644
--- a/jetty-servlets/src/main/config/modules/servlets.mod
+++ b/jetty-servlets/src/main/config/modules/servlets.mod
@@ -1,7 +1,8 @@
-#
-# Jetty Servlets Module
-#
-
+[description]
+Puts a collection of jetty utility servlets and filters
+on the server classpath (CGI, CrossOriginFilter, DosFilter,
+MultiPartFilter, PushCacheFilter, QoSFilter, etc.) for
+use by all webapplications.
[depend]
servlet
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 44db8aecf3..544c392a9c 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
@@ -34,7 +34,6 @@ import java.util.concurrent.atomic.AtomicLong;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
-import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@@ -45,7 +44,7 @@ import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpURI;
import org.eclipse.jetty.http.HttpVersion;
-import org.eclipse.jetty.server.Dispatcher;
+import org.eclipse.jetty.server.PushBuilder;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil;
@@ -189,14 +188,13 @@ public class PushCacheFilter implements Filter
long primaryTimestamp = primaryResource._timestamp.get();
if (primaryTimestamp != 0)
{
- RequestDispatcher dispatcher = request.getServletContext().getRequestDispatcher(path);
if (now - primaryTimestamp < TimeUnit.MILLISECONDS.toNanos(_associatePeriod))
{
- ConcurrentMap<String, RequestDispatcher> associated = primaryResource._associated;
+ ConcurrentMap<String, String> associated = primaryResource._associated;
// Not strictly concurrent-safe, just best effort to limit associations.
if (associated.size() <= _maxAssociations)
{
- if (associated.putIfAbsent(path, dispatcher) == null)
+ if (associated.putIfAbsent(path, path) == null)
{
if (LOG.isDebugEnabled())
LOG.debug("Associated {} to {}", path, referrerPathNoContext);
@@ -256,11 +254,14 @@ public class PushCacheFilter implements Filter
// Push associated for non conditional
if (!conditional && !primaryResource._associated.isEmpty())
{
- for (RequestDispatcher dispatcher : primaryResource._associated.values())
+ PushBuilder builder = Request.getBaseRequest(request).getPushBuilder();
+
+ for (String associated : primaryResource._associated.values())
{
if (LOG.isDebugEnabled())
- LOG.debug("Pushing {} for {}", dispatcher, path);
- ((Dispatcher)dispatcher).push(request);
+ LOG.debug("Pushing {} for {}", associated, path);
+
+ builder.path(associated).push();
}
}
@@ -300,7 +301,7 @@ public class PushCacheFilter implements Filter
private static class PrimaryResource
{
- private final ConcurrentMap<String, RequestDispatcher> _associated = new ConcurrentHashMap<>();
+ private final ConcurrentMap<String, String> _associated = new ConcurrentHashMap<>();
private final AtomicLong _timestamp = new AtomicLong();
}
}
diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/ThreadStarvationTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/ThreadStarvationTest.java
index 9243ca7ccb..88647ab355 100644
--- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/ThreadStarvationTest.java
+++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/ThreadStarvationTest.java
@@ -49,6 +49,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.eclipse.jetty.io.ChannelEndPoint;
import org.eclipse.jetty.io.ManagedSelector;
import org.eclipse.jetty.io.SelectChannelEndPoint;
import org.eclipse.jetty.server.HttpChannel;
@@ -110,7 +111,7 @@ public class ThreadStarvationTest
ServerConnector connector = new ServerConnector(_server, 0, 1)
{
@Override
- protected SelectChannelEndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey key) throws IOException
+ protected ChannelEndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey key) throws IOException
{
return new SelectChannelEndPoint(channel, selectSet, key, getScheduler(), getIdleTimeout())
{
@@ -264,7 +265,7 @@ public class ThreadStarvationTest
ServerConnector connector = new ServerConnector(_server, acceptors, selectors)
{
@Override
- protected SelectChannelEndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey key) throws IOException
+ protected ChannelEndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey key) throws IOException
{
return new SelectChannelEndPoint(channel, selectSet, key, getScheduler(), getIdleTimeout())
{

Back to the top