diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 14c84ac2978..6f7a14ccf5d 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -63,7 +63,7 @@ import javax.servlet.http.HttpUpgradeHandler; import javax.servlet.http.MappingMatch; import javax.servlet.http.Part; import javax.servlet.http.PushBuilder; -import javax.servlet.http.ServletMapping; +import javax.servlet.http.HttpServletMapping; import org.eclipse.jetty.http.BadMessageException; import org.eclipse.jetty.http.HostPortHttpField; @@ -2452,9 +2452,9 @@ public class Request implements HttpServletRequest return _pathSpec; } - + // TODO replace with overriden version from API - public ServletMapping getMapping() + public HttpServletMapping getMapping() { final PathSpec pathSpec = _pathSpec; final MappingMatch match; @@ -2496,7 +2496,7 @@ public class Request implements HttpServletRequest mapping = _servletPath; } - return new ServletMapping() + return new HttpServletMapping() { @Override public String getMatchValue() diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index 6ecb183a84c..dfcbd76f18f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -109,7 +109,7 @@ public class Response implements HttpServletResponse private OutputType _outputType = OutputType.NONE; private ResponseWriter _writer; private long _contentLength = -1; - private Supplier trailers; + private Supplier _trailers; private enum EncodingFrom { NOT_SET, INFERRED, SET_LOCALE, SET_CONTENT_TYPE, SET_CHARACTER_ENCODING } private static final EnumSet __localeOverride = EnumSet.of(EncodingFrom.NOT_SET,EncodingFrom.INFERRED); @@ -1316,34 +1316,27 @@ public class Response implements HttpServletResponse @Deprecated public void setTrailerHttpFields(Supplier trailers) { - this.trailers = trailers; + this._trailers = trailers; } - // TODO: @Override + @Override public void setTrailerFields(Supplier> trailers) { // TODO new for 4.0 - avoid transient supplier? - this.trailers = new Supplier() - { - @Override - public HttpFields get() - { - Map t = trailers.get(); - if (t==null) - return null; - HttpFields fields = new HttpFields(); - for (Map.Entry e : t.entrySet()) - { - fields.add(e.getKey(),e.getValue()); - } - return fields; - } - }; + this._trailers = new HttpFieldsSupplier(trailers); } public Supplier getTrailers() { - return trailers; + return _trailers; + } + + @Override + public Supplier> getTrailerFields() + { + if (_trailers instanceof HttpFieldsSupplier) + ((HttpFieldsSupplier)_trailers).getSupplier(); + return null; } protected MetaData.Response newResponseMetaData() @@ -1511,4 +1504,33 @@ public class Response implements HttpServletResponse response.setHeader(HttpHeader.ETAG.asString(),et); } } + + private static class HttpFieldsSupplier implements Supplier + { + private final Supplier> _supplier; + + public HttpFieldsSupplier(Supplier> trailers) + { + _supplier = trailers; + } + + @Override + public HttpFields get() + { + Map t = _supplier.get(); + if (t==null) + return null; + HttpFields fields = new HttpFields(); + for (Map.Entry e : t.entrySet()) + { + fields.add(e.getKey(),e.getValue()); + } + return fields; + } + + public Supplier> getSupplier() + { + return _supplier; + } + } } diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/HostPort.java b/jetty-util/src/main/java/org/eclipse/jetty/util/HostPort.java index 250c296fae3..761f2bcc806 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/HostPort.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/HostPort.java @@ -23,11 +23,11 @@ package org.eclipse.jetty.util; *

Parse a string in the form "host:port", handling IPv4 an IPv6 hosts

* *

The System property "org.eclipse.jetty.util.HostPort.STRIP_IPV6" can be set to a boolean - * value to control of the square brackets are stripped off IPv6 addresses (default false).

+ * value to control of the square brackets are stripped off IPv6 addresses (default true).

*/ public class HostPort { - private final static boolean STRIP_IPV6 = Boolean.parseBoolean(System.getProperty("org.eclipse.jetty.util.HostPort.STRIP_IPV6","false")); + private final static boolean STRIP_IPV6 = Boolean.parseBoolean(System.getProperty("org.eclipse.jetty.util.HostPort.STRIP_IPV6","true")); private final String _host; private final int _port; diff --git a/jetty-websocket/websocket-tests/src/main/java/org/eclipse/jetty/websocket/tests/LocalFuzzer.java b/jetty-websocket/websocket-tests/src/main/java/org/eclipse/jetty/websocket/tests/LocalFuzzer.java index 0c8560008e6..7674239cc90 100644 --- a/jetty-websocket/websocket-tests/src/main/java/org/eclipse/jetty/websocket/tests/LocalFuzzer.java +++ b/jetty-websocket/websocket-tests/src/main/java/org/eclipse/jetty/websocket/tests/LocalFuzzer.java @@ -131,7 +131,7 @@ public class LocalFuzzer implements AutoCloseable prefix = "Frame[" + i + "]"; WebSocketFrame expected = expect.get(i); - WebSocketFrame actual = framesQueue.poll(3, TimeUnit.SECONDS); + WebSocketFrame actual = framesQueue.poll(10, TimeUnit.SECONDS); assertThat(prefix + ".poll", actual, notNullValue()); if (LOG.isDebugEnabled()) @@ -365,4 +365,4 @@ public class LocalFuzzer implements AutoCloseable LocalConnector.LocalEndPoint newLocalConnection(); } -} \ No newline at end of file +} diff --git a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketCloseTest.java b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketCloseTest.java index f14ab1da8de..dd6a379541f 100644 --- a/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketCloseTest.java +++ b/jetty-websocket/websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/server/WebSocketCloseTest.java @@ -271,7 +271,19 @@ public class WebSocketCloseTest assertThat("No frames as output", framesQueue.size(), Matchers.is(0)); } } - + + /** + * + * @throws Exception on test failure + */ + @Test + public void testFastFailFastClose() throws Exception + { + fastFail(); + fastClose(); + } + + /** * Test session open session cleanup (bug #474936) * diff --git a/jetty-websocket/websocket-tests/src/test/resources/jetty-logging.properties b/jetty-websocket/websocket-tests/src/test/resources/jetty-logging.properties index 645e626e47e..71fb0b968b6 100644 --- a/jetty-websocket/websocket-tests/src/test/resources/jetty-logging.properties +++ b/jetty-websocket/websocket-tests/src/test/resources/jetty-logging.properties @@ -26,7 +26,7 @@ org.eclipse.jetty.LEVEL=WARN # org.eclipse.jetty.io.WriteFlusher.LEVEL=DEBUG # org.eclipse.jetty.io.FillInterest.LEVEL=DEBUG # org.eclipse.jetty.client.LEVEL=DEBUG -# org.eclipse.jetty.websocket.LEVEL=DEBUG +org.eclipse.jetty.websocket.LEVEL=DEBUG # org.eclipse.jetty.websocket.LEVEL=INFO # org.eclipse.jetty.websocket.jsr356.messages.LEVEL=DEBUG # org.eclipse.jetty.websocket.tests.LEVEL=DEBUG diff --git a/pom.xml b/pom.xml index 416d6941e03..e9b8db2932e 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ 1.2 1.1.3.v20160715 8.5.9.1 - 4.0.0-b05 + 4.0.0-b07 undefined