minor cleanups of exceptions

This commit is contained in:
Greg Wilkins 2014-09-18 18:23:48 +10:00
parent 2018098225
commit 0acee9851f
6 changed files with 22 additions and 2 deletions

View File

@ -32,6 +32,7 @@ import java.util.Queue;
import org.eclipse.jetty.http2.frames.Frame;
import org.eclipse.jetty.http2.frames.WindowUpdateFrame;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.util.ArrayQueue;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.IteratingCallback;
@ -346,7 +347,7 @@ public class HTTP2Flusher extends IteratingCallback
public void reset()
{
failed(new EOFException("reset"));
failed(new EofException("reset"));
}
@Override

View File

@ -44,6 +44,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-server</artifactId>

View File

@ -94,6 +94,7 @@ public class HttpChannelOverHTTP2 extends HttpChannel
public void onPushRequest(MetaData.Request request)
{
onRequest(request);
getRequest().setAttribute("org.eclipse.jetty.pushed",Boolean.TRUE);
if (LOG.isDebugEnabled())
{

View File

@ -96,7 +96,7 @@ public class HttpTransportOverHTTP2 implements HttpTransport
}
else
{
callback.failed(new IllegalStateException());
callback.failed(new IllegalStateException("committed"));
}
}
else

View File

@ -21,7 +21,9 @@ package org.eclipse.jetty.http2.server;
import java.io.IOException;
import java.util.Date;
import java.util.EnumSet;
import javax.servlet.DispatcherType;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
@ -42,6 +44,7 @@ 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.ssl.SslContextFactory;
@ -56,6 +59,7 @@ public class Http2Server
ServletContextHandler context = new ServletContextHandler(server, "/",ServletContextHandler.SESSIONS);
context.setResourceBase("/tmp");
context.addFilter(PushCacheFilter.class,"/*",EnumSet.of(DispatcherType.REQUEST));
context.addServlet(new ServletHolder(servlet), "/test/*");
context.addServlet(DefaultServlet.class, "/");
server.setHandler(context);

View File

@ -79,6 +79,14 @@ public class PushCacheFilter implements Filter
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException
{
HttpServletRequest request = (HttpServletRequest)req;
if (Boolean.TRUE==req.getAttribute("org.eclipse.jetty.pushed"))
{
LOG.debug("PUSH {}", request.getRequestURI());
chain.doFilter(req,resp);
return;
}
// Iterating over fields is more efficient than multiple gets
HttpFields fields = Request.getBaseRequest(req).getHttpFields();