diff --git a/Jenkinsfile b/Jenkinsfile index 0016dc734dd..185f2d6ab31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,7 +53,7 @@ node { withEnv(mvnEnv) { timeout(time: 90, unit: 'MINUTES') { // Run test phase / ignore test failures - sh "mvn -B install -Dmaven.test.failure.ignore=true" + sh "mvn -B install -Dmaven.test.failure.ignore=true -Prun-its" // Report failures in the jenkins UI step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml']) diff --git a/VERSION.txt b/VERSION.txt index bfc9e8b6d1f..ca16e0daa48 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,25 +1,4 @@ -jetty-9.3.22-SNAPSHOT - -jetty-9.3.21.M0 - 01 August 2017 - + 1357 RolloverFileOutputStream: No rollout performed at midnight - + 1469 RolloverFileOutputStream: IllegalStateException Task already scheduled - + 1507 RolloverFileOutputStream: Negative delay Timer.schedule exception - + 1513 RolloverFileOutputStream: can't handle multiple instances - + 1655 Improve extensibility of ServerConnector - + 1661 AbstractProxyServlet onProxyResponseFailure Error - + 1664 IPAccessHandler CIDR IP range check is incorrect - + 1685 Update ALPN support for Java 8u141 - + 1687 HTTP2: Correcting missing callback notification when channel not found - + 1702 Update ALPN support for Java 8u144 - + 1703 Improve HttpInput failure logging - -jetty-9.3.20.v20170531 - 31 May 2017 - + 523 TLS close behaviour breaking session resumption - + 1108 Please improve logging in SslContextFactory when there are no approved - cipher suites - + 1527 Jetty BOM should not depend on jetty-parent - + 1556 A timing channel in Password.java - + 1567 XmlConfiguration will start the same object multiple times +jetty-9.4.7-SNAPSHOT jetty-9.2.22.v20170606 - 06 June 2017 + 920 no main manifest attribute, in jetty-runner-9.2.19.v20160908.jar @@ -33,10 +12,9 @@ jetty-9.2.22.v20170606 - 06 June 2017 + 1523 Update ALPN support for Java 8u131 + 1556 A timing channel in Password.java + 1590 RolloverFileOutputStream not functioning in Jetty 9.2.21+ -jetty-9.2.23-SNAPSHOT -jetty-9.2.22.v20170606 - 06 June 2017 - + 920 no main manifest attribute, in jetty-runner-9.2.19.v20160908.jar +jetty-9.4.6.v20170531 - 31 May 2017 + + 523 TLS close behaviour breaking session resumption + 1108 Please improve logging in SslContextFactory when there are no approved cipher suites + 1505 Adding jetty.base.uri and jetty.home.uri @@ -63,6 +41,14 @@ jetty-9.2.22.v20170606 - 06 June 2017 + 1569 Allow setting of maxBinaryMessageSize to 0 in WebSocketPolicy + 1579 NPE in Quoted Quality CSV +jetty-9.3.20.v20170531 - 31 May 2017 + + 523 TLS close behaviour breaking session resumption + + 1108 Please improve logging in SslContextFactory when there are no approved + cipher suites + + 1527 Jetty BOM should not depend on jetty-parent + + 1556 A timing channel in Password.java + + 1567 XmlConfiguration will start the same object multiple times + jetty-9.4.5.v20170502 - 02 May 2017 + 304 Review dead code - StringUtil.sidBytesToString + 1235 DNS lookup in newSSLEngine(InetSocketAddress address) @@ -95,6 +81,20 @@ jetty-9.4.5.v20170502 - 02 May 2017 + 1521 Prevent copy of jetty jars to lib/gcloud + 1523 Update ALPN support for Java 8u131 +jetty-9.3.19.v20170502 - 02 May 2017 + + 877 Programmatic servlet mappings cannot override mappings from + webdefault.xml using quickstart + + 1348 Add a BOM artifact + + 1390 HashLoginService and "this.web-inf.url" property are incompatible + + 1463 SSL Renegotiate limit + + 1469 IllegalStateException in RolloverFileOutputStream + + 1486 redirect to welcome file broken for sub directory + + 1487 add decoded paths + + 1507 Negative delay Timer.schedule exception due to mismatched local and + _logTimeZone values + + 1513 RolloverFileOutputStream can't handle multiple instances + + 1523 Update ALPN support for Java 8u131 + jetty-9.4.4.v20170414 - 14 April 2017 + 612 Support HTTP Trailer + 877 Programmatic servlet mappings cannot override mappings from @@ -128,6 +128,13 @@ jetty-9.4.4.v20170414 - 14 April 2017 + 1472 Broken *.gz symlinks cause NPE in DefaultServlet + 1475 SIOOBE in ContextHandler startup +jetty-9.3.18.v20170406 - 06 April 2017 + + 877 Programmatic servlet mappings cannot override mappings from + webdefault.xml using quickstart + + 1201 X-Forwarded-For incorrectly set in jetty-http-forwarded.xml + + 1417 Improve classloader dumping + + 1439 Allow UNC paths to function as Resource bases + jetty-9.4.3.v20170317 - 17 March 2017 + 329 Javadoc for HttpTester and ServletTester needs to reference limited HTTP version scope @@ -156,18 +163,14 @@ jetty-9.4.3.v20170317 - 17 March 2017 + 1403 Move new CookieCompliance class to jetty-http + 1405 Cookie name cannot be blank or null -jetty-9.3.18.v20170406 - 06 April 2017 - + 877 Programmatic servlet mappings cannot override mappings from - webdefault.xml using quickstart - + 1201 X-Forwarded-For incorrectly set in jetty-http-forwarded.xml - + 1417 Improve classloader dumping - + 1439 Allow UNC paths to function as Resource bases - jetty-9.3.17.v20170317 - 17 March 2017 + 329 Javadoc for HttpTester and ServletTester needs to reference limited HTTP version scope + + 609 websocket ClientCloseTest testServerNoCloseHandshake is failing + 1015 Ensure jetty-distribution excludes git / temp files + 1047 ReadPendingException and then thread death + + 1049 test-jetty-osgi test exits/crashes the surefire forked JVM + + 1282 ByteArrayEndPointTest.testIdle() failure + 1296 Introduce HTTP parser "content complete" event + 1326 Jetty shutdown command got NullPointerException (http2 module added to start) @@ -185,7 +188,9 @@ jetty-9.3.17.v20170317 - 17 March 2017 + 1387 Windows and paxexam failure due to "renaming bundle" + 1389 Update to gcloud datastore-0.9.4-beta + 1390 HashLoginService and "this.web-inf.url" property are incompatible + + 1394 Default OS Locale/Encoding/Charset can cause test failures + 1396 Set-Cookie produced by Jetty is invalid for RFC6265 and Chrome + + 1399 SlowClientTest is failing on CI + 1401 HttpOutput.recycle() does not clear the write listener jetty-9.4.2.v20170220 - 20 February 2017 @@ -275,17 +280,6 @@ jetty-9.4.1.v20170120 - 20 January 2017 + 1276 Remove org.eclipse.jetty.websocket.server.WebSocketServerFactory from SPI -jetty-9.4.0.v20161208 - 08 December 2016 - + 1112 How config async support in jsp tag? - + 1124 Allow configuration of WebSocket mappings from Spring - + 1139 Support configuration of properties during --add-to-start - + 1146 jetty.server.HttpInput deadlock - + 1148 Support HTTP/2 HEADERS trailer - + 1151 NPE in ClasspathPattern.match() - + 1153 Make SessionData easier to subclass - + 123 AbstractSessionIdManager can't atomically check for uniqueness of new - session ID - jetty-9.3.16.v20170120 - 20 January 2017 + 486 JDK 9 ALPN implementation + 592 Support no-value Host header in HttpParser @@ -300,6 +294,9 @@ jetty-9.3.16.v20170120 - 20 January 2017 + 1229 ClassLoader constraint issue when using NativeWebSocketConfiguration with WEB-INF/lib/jetty-http.jar present + 1234 onBadMessage called from with handled message + + 1259 HostnameVerificationTest.simpleGetWithHostnameVerificationEnabledTest + is broken + + 1261 Intermittent H2C test failure AsyncIOServletTest.testAsyncReadEarlyEOF + 1262 BufferUtil.isMappedBuffer() uses reflection on private JDK fields + 1265 JAXB not available in JDK 9 + 1267 Request.getRemoteUser can throw undeclared IllegalStateException via @@ -313,6 +310,14 @@ jetty-9.3.16.v20170120 - 20 January 2017 + 1275 Get rid of Mockito + 1276 Remove org.eclipse.jetty.websocket.server.WebSocketServerFactory from SPI + + 1277 http2 alpn test error + +jetty-9.2.21.v20170120 - 20 January 2017 + + 592 Support no-value Host header in HttpParser + + 1229 ClassLoader constraint issue when using NativeWebSocketConfiguration + with WEB-INF/lib/jetty-http.jar present + + 1267 Request.getRemoteUser can throw undeclared IllegalStateException via + DeferredAuthentication & FormAuthenticator jetty-9.3.15.v20161220 - 20 December 2016 + 240 Missing content for multipart request after upgrade to Jetty > 9.2.7 @@ -341,6 +346,7 @@ jetty-9.3.15.v20161220 - 20 December 2016 + 1099 PushCacheFilter pushes POST requests + 1108 Please improve logging in SslContextFactory when there are no approved cipher suites + + 1114 Add testcase for WSUF for stop/start of the Server + 1118 Filter.destroy() conflicts with ContainerLifeCycle.destroy() in WebSocketUpgradeFilter + 1123 Broken lifecycle for WebSocket's mappings @@ -360,12 +366,27 @@ jetty-9.3.15.v20161220 - 20 December 2016 + 1186 Where can i find SocketConnector .java and BlockingChannelConnector.java etc? -jetty-9.2.21.v20170120 - 20 January 2017 - + 592 Support no-value Host header in HttpParser - + 1229 ClassLoader constraint issue when using NativeWebSocketConfiguration - with WEB-INF/lib/jetty-http.jar present - + 1267 Request.getRemoteUser can throw undeclared IllegalStateException via - DeferredAuthentication & FormAuthenticator +jetty-9.2.20.v20161216 - 16 December 2016 + + 295 Ensure Jetty Client use of Deflater / Inflater calls .end() to avoid + memory leak + + Reset Response buffer size + + 1051 NCSARequestLog/RolloverFileOutputStream does not roll day after DST + ends + + 1057 Improve WebSocketUpgradeFilter fast path performance + + 1090 Allow WebSocketUpgradeFilter to be used by WEB-INF/web.xml + + 1124 Allow configuration of WebSocket mappings from Spring + + 1130 PROXY protocol support reports incorrect remote address + +jetty-9.4.0.v20161208 - 08 December 2016 + + 1112 How config async support in jsp tag? + + 1124 Allow configuration of WebSocket mappings from Spring + + 1139 Support configuration of properties during --add-to-start + + 1146 jetty.server.HttpInput deadlock + + 1148 Support HTTP/2 HEADERS trailer + + 1151 NPE in ClasspathPattern.match() + + 1153 Make SessionData easier to subclass + + 123 AbstractSessionIdManager can't atomically check for uniqueness of new + session ID jetty-9.4.0.RC3 - 05 December 2016 + 1051 NCSARequestLog/RolloverFileOutputStream does not roll day after DST @@ -438,6 +459,23 @@ jetty-9.4.0.RC2 - 16 November 2016 + 1099 PushCacheFilter pushes POST requests + 1103 AbstractNCSARequestLog reports too much of the Request URI +jetty-9.3.14.v20161028 - 28 October 2016 + + 292 NPE in SslConnectionFactory newConnection + + 295 Ensure Jetty Client use of Deflater / Inflater calls .end() to avoid + memory leak + + 989 InputStreamResponseListener.get() throws with HTTP/2 following redirect + + 1009 9.3.x] ThreadLimitHandler has no method setBlockForMs + + 1018 Remove dependency on asm types in oej.annotations.Util + + 1029 Restore Request.setHttpVersion() + + 1031 Improve HttpField pre-encoding + + 1032 Remove jetty dependencies in jetty jasper classes + + 1037 Don't execute AsyncListener.onTimeout events in spare Scheduler-Thread + + 1038 AttributeNormalizer does not favor ${WAR} over other attributes, like + ${jetty.base} + + 1039 AttributeNormalizer should not track attributes that are null + + 1046 Improve HTTP2Flusher error report + + 480764 Add extra tests for empty multipart + jetty-9.4.0.RC1 - 21 October 2016 + 277 Proxy servlet does not handle HTTP status 100 correctly + 292 NPE in SslConnectionFactory newConnection @@ -479,6 +517,27 @@ jetty-9.4.0.RC1 - 21 October 2016 + 1017 Output session configuration for dump + 1018 Remove dependency on asm types in oej.annotations.Util +jetty-9.3.13.v20161014 - 14 October 2016 + + 295 Ensure Jetty Client use of Deflater / Inflater calls .end() to avoid + memory leak + + 926 No LSB Tags on jetty.sh script cause warning on Ubuntu 16.04 + + 999 Create a Flight Recorder module + + 1000 Allow legacy behaviour if 2 servlets map to same path + +jetty-9.3.13.M0 - 30 September 2016 + + 277 Proxy servlet does not handle HTTP status 100 correctly + + 870 TLS protocol exclusion broken for SslContextFactory(String) + + 915 The jetty-maven-plugin:stop goal doesn't stop everything completely + + 918 Support certificates hot reload + + 930 Add module instructions to SSL section + + 943 Docs: Error in 'Embedding Jetty' page - example 'FileServer' + + 948 9.4.0.RC0 jetty-distribution invalid config etc/jetty-http2c.xml + + 955 Response listeners not invoked when using Connection.send() + + 959 CompleteListener invoked twice for HTTP/2 transport and response content + + 960 Async I/O spin when reading early EOF + + 965 Link from High Load docs to Garbage Collection Tuning is broken + + 966 Remove usages of ConcurrentArrayQueue + jetty-9.4.0.RC0 - 15 September 2016 + 131 Improve Connector Statistic names and values + 572 Don't reject HTTP/2 requests without body in low threads mode @@ -514,6 +573,54 @@ jetty-9.4.0.RC0 - 15 September 2016 + 922 Implements methods Connection.getBytes[In|Out]() + 931 Update gcloud datastore to 0.3.0 +jetty-9.3.12.v20160915 - 15 September 2016 + + 56 Fix authn issues in LdapLoginModule + + 131 Improve Connector Statistic names and values + + 185 Implement RFC 7239 (Forwarded header) + + 700 Bundle org.eclipse.jetty.http.spi not available via p2 repository + + 725 Provide a private way to report security issues + + 752 Implement support for HTTP2 SETTINGS_MAX_HEADER_LIST_SIZE + + 759 Ensure wrapped Responses will close and commit outputstream or writer + + 780 The moved websocket PathSpec is incompatible with cometd 3.0.x + + 783 Report name of broken jar file + + 784 JSP Session updated before sendRedirect() lose their information + + 786 Buffering Response Handler + + 790 AsyncContentListener semantic broken with HTTP/2 transport + + 792 HTTP/2] Socket seems to be not closed completely + + 797 MimeTypes resource loading incorrect on OSGi + + 798 async IO Write closed race + + 804 setting default Url Encoding broken in Jetty >= 9.3 + + 806 Jetty HttpClient authentication - missing any realm option + + 817 NPE in jndi Resource + + 826 Better default for HTTP/2's max concurrent streams + + 827 HTTPClient fails connecting to HTTPS host through an HTTP proxy + w/authentication + + 830 Test webapp not properly copied to demo-base + + 832 ServerWithJNDI example uses wrong webapp + + 841 support reset in buffering interceptors + + 844 Implement a Thread Limit Handler + + 845 Improve blocking IO for data rate limiting + + 851 MBeanContainer no longer unregisters MBeans when "stopped" + + 854 If container.destroy() is called, calling container.start() again should + throw an IllegalStateException + + 855 JMXify MBeanContainer + + 860 Only TLS 1.2 Supported + + 868 ClassLoader leak with Jetty and Karaf - static instances of + java.lang.Throwable + + 880 Refactor jetty-http's HostPortHttpField logic into new jetty-util class + + 882 Add IPv6 support to IPAddressMap in jetty-util + + 889 ConstantThrowable.name can be removed + + 894 When adding servless class, preserve Class instead of going through + String + + 897 Remove GzipHandler interceptor when out of scope + + 898 GzipHandler adds multiple Vary header + + 902 Expect: 100-Continue does not work with HTTP/2 + + 909 Path and Domain not properly matched in addCookie() + + 911 Request.getRequestURI() gets decoded after startAsync(req, resp) is + invoked + + 913 Unprotected debug in WebAppClassLoader + + 922 Implements methods Connection.getBytes[In|Out]() + jetty-9.4.0.M1 - 15 August 2016 + 185 Implement RFC 7239 (Forwarded header) + 213 jetty.osgi.boot requires Server services registered before @@ -614,6 +721,117 @@ jetty-9.4.0.M1 - 15 August 2016 + 837 Update to support apache jasper 8.5.4 + 841 support reset in buffering interceptors +jetty-9.3.11.v20160721 - 21 July 2016 + + 230 customize Content-Type in ErrorHandler's default error page + + 592 Support no-value Host header in HttpParser + + 631 SLOTH protection + + 643 NPE in passing websocket client test + + 649 LDAPLoginModule should disallow blank username and password + + 658 Add memcached option for gcloud-sessions in jetty-9.3 + + 660 NullPointerException in Request.getParameter: _parameters is null + + 663 Update gcloud datastore to 0.2.3 + + 667 Introduce optional `jetty.deploy.monitoredPath` for jetty-deploy paths + outside of ${jetty.base} + + 668 Introduce optional `jetty.deploy.defaultsDescriptorPath` for + jetty-deploy defaults descriptor outside of ${jetty.home} + + 669 Support UNC paths in PathResource + + 671 Incorrect ALPN default protocol + + 672 Allow logging configuration announcement to be programmatically disabled + + 673 ClasspathPattern needs a match all pattern + + 675 Slf4jLog.ignore() should produce at DEBUG level + + 676 JavaUtilLog.ignore() should produce at DEBUG level + + 677 Logging of .ignore() should indicate that it was an "Ignored Exception" + + 678 Log at less than DEBUG level when annotation scanning takes significant + time + + 682 Quickstart should not scan all container path jars + + 684 HttpClient proxies (HttpProxy and Socks4Proxy) do not support + authentication + + 685 SecureRequestCustomizer SSLSession attribute not set + + 687 AllowSymLinkAliasChecker not normalizing relative symlinks properly + + 690 jetty-maven-plugin does not configure AnnotationConfiguration for + jetty:effective-web-xml goal + + 693 QoSFilterTest failures are not capture by junit + + 694 http2.client.StreamResetTest.testServerExceptionConsumesQueuedData stack + not suppressed in test + + 695 Deprecate LocalConnector.getResponses() in favor of using .getResponse() + + 696 LocalConnector.getResponse() doesn't find close if using HTTP/1.1 + w/Connection: close + + 701 Document CachingWebAppClassLoader + + 706 org.apache.jasper.compiler.disablejsr199 is no longer present in Jetty + 9.3+ + + 708 SslContextFactory: newSslServerSocket/newSslSocket customization + + 717 GzipHandler.minGzipSize still compresses small responses + + 718 Document HttpClient transports + + 720 asciiToLowerCase throws NullPointerException + + 721 HTTP Response header value encoding is invalid for RFC7230 + + 723 Improve bad/missing mime.properties reporting + + 726 Http2 Client parse error + + 730 "Slow" client causes IllegalStateException + + 733 Allow setCharacterEncoding after getOutputStream + + 739 Illegal WindowUpdate frame with delta=0 + + 742 Fixed link to webtide.com + + 745 Removed README.txt + + 747 Update documentation to reflect TLS and SSL support + + 751 Remove usages of ArrayQueue + + 752 Implement support for HTTP2 SETTINGS_MAX_HEADER_LIST_SIZE + + 755 NPE in HttpChannelOverHTTP2.requestContent() + + 756 Filter problematic headers from CGI and FastCGIProxy + +jetty-9.2.19.v20160908 - 08 September 2016 + + 817 NPE in jndi Resource + + 830 Test webapp not properly copied to demo-base + + 832 ServerWithJNDI example uses wrong webapp + + 851 MBeanContainer no longer unregisters MBeans when "stopped" + + 868 ClassLoader leak with Jetty and Karaf - static instances of + java.lang.Throwable + + 880 Refactor jetty-http's HostPortHttpField logic into new jetty-util class + + 882 Add IPv6 support to IPAddressMap in jetty-util + + 894 When adding servless class, preserve Class instead of going through + String + + 899 PathFinderTest fails in jetty-9.2.x + +jetty-9.2.18.v20160721 - 21 July 2016 + + 425 Incorrect @ServerEndpoint Encoder/Decoder lifecycle + + 649 LDAPLoginModule should disallow blank username and password + + 654 Jetty 9.3 ServletContext.getResourceAsStream("/") returns an unusable + stream + + 661 JsrExtension is missing hashCode() and equals() + + 756 Filter problematic headers from CGI and FastCGIProxy + +jetty-9.3.11.M0 - 22 June 2016 + + 425 Incorrect @ServerEndpoint Encoder/Decoder lifecycle + + 624 AsyncContext.onCompleted called twice + + 645 jetty-requestlog.xml default log path + + 654 Jetty 9.3 ServletContext.getResourceAsStream("/") returns an unusable + stream + + 659 CONNECT request fails spuriously + + 660 NullPointerException in Request.getParameter: _parameters is null + + 661 JsrExtension is missing hashCode() and equals() + +jetty-9.3.10.v20160621 - 21 June 2016 + + 388 Add methods to send text frames with pre-encoded strings + + 605 Guard concurrent calls to WebSocketSession.close() + + 608 reset encoding set from content type? + + 609 websocket ClientCloseTest testServerNoCloseHandshake is failing + + 610 HttpClientRedirectTest/testRedirectWithWrongScheme test failing in CI + + 620 Missing call to setPattern in RewritePatternRule constructor + + 622 NoSqlSessionManager test for expired session does not use + session.maxInactiveInterval + + 623 Add --gzip suffix to 304 responses with ETAGs + + 624 AsyncContext.onCompleted called twice + + 628 IOException: Unable to open root Jar file + MetaInfConfiguration.getTlds(MetaInfConfiguration.java:406) with Spring boot + loader + WebAppContext + non-expanded war + + 632 JMX tests rely on fixed port + + 633 If jmx and websocket is enabled, redploying a context produces a + NullPointerException + + 638 ConnectHandler responses should have Content-Length + + 639 ServerContainer stores WebSocket sessions twice + + 640 ClientContainer should store WebSocket sessions as beans + + 641 MongoSessionIdManager uses deprecated ensureIndex + + 647 HTTP/2 CONTINUATION frame parsing throws IllegalStateException + + 648 Problem using InputStreamResponseListener to handle HTTP/2 responses + jetty-9.4.0.M0 - 03 June 2016 + 356 Element error-page/location must start with a '/' + 360 Improve HTTP/2 stream interleaving @@ -687,203 +905,6 @@ jetty-9.4.0.M0 - 03 June 2016 + 605 Guard concurrent calls to WebSocketSession.close() + 608 reset encoding set from content type -jetty-9.2.20.v20161216 - 16 December 2016 - + 295 Ensure Jetty Client use of Deflater / Inflater calls .end() to avoid - memory leak - + Reset Response buffer size - + 1051 NCSARequestLog/RolloverFileOutputStream does not roll day after DST - ends - + 1057 Improve WebSocketUpgradeFilter fast path performance - + 1090 Allow WebSocketUpgradeFilter to be used by WEB-INF/web.xml - + 1124 Allow configuration of WebSocket mappings from Spring - + 1130 PROXY protocol support reports incorrect remote address - -jetty-9.3.14.v20161028 - 28 October 2016 - + 292 NPE in SslConnectionFactory newConnection - + 295 Ensure Jetty Client use of Deflater / Inflater calls .end() to avoid - memory leak - + 989 InputStreamResponseListener.get() throws with HTTP/2 following redirect - + 1009 9.3.x] ThreadLimitHandler has no method setBlockForMs - + 1018 Remove dependency on asm types in oej.annotations.Util - + 1029 Restore Request.setHttpVersion() - + 1031 Improve HttpField pre-encoding - + 1032 Remove jetty dependencies in jetty jasper classes - + 1037 Don't execute AsyncListener.onTimeout events in spare Scheduler-Thread - + 1038 AttributeNormalizer does not favor ${WAR} over other attributes, like - ${jetty.base} - + 1039 AttributeNormalizer should not track attributes that are null - + 1046 Improve HTTP2Flusher error report - -jetty-9.3.13.v20161014 - 14 October 2016 - + 295 Ensure Jetty Client use of Deflater / Inflater calls .end() to avoid - memory leak - + 926 No LSB Tags on jetty.sh script cause warning on Ubuntu 16.04 - + 999 Create a Flight Recorder module - + 1000 Allow legacy behaviour if 2 servlets map to same path - -jetty-9.3.13.M0 - 30 September 2016 - + 277 Proxy servlet does not handle HTTP status 100 correctly - + 870 TLS protocol exclusion broken for SslContextFactory(String) - + 915 The jetty-maven-plugin:stop goal doesn't stop everything completely - + 918 Support certificates hot reload - + 930 Add module instructions to SSL section - + 943 Docs: Error in 'Embedding Jetty' page - example 'FileServer' - + 948 9.4.0.RC0 jetty-distribution invalid config etc/jetty-http2c.xml - + 955 Response listeners not invoked when using Connection.send() - + 959 CompleteListener invoked twice for HTTP/2 transport and response content - + 960 Async I/O spin when reading early EOF - + 965 Link from High Load docs to Garbage Collection Tuning is broken - + 966 Remove usages of ConcurrentArrayQueue - -jetty-9.3.12.v20160915 - 15 September 2016 - + 56 Fix authn issues in LdapLoginModule - + 131 Improve Connector Statistic names and values - + 185 Implement RFC 7239 (Forwarded header) - + 700 Bundle org.eclipse.jetty.http.spi not available via p2 repository - + 725 Provide a private way to report security issues - + 752 Implement support for HTTP2 SETTINGS_MAX_HEADER_LIST_SIZE - + 759 Ensure wrapped Responses will close and commit outputstream or writer - + 780 The moved websocket PathSpec is incompatible with cometd 3.0.x - + 783 Report name of broken jar file - + 784 JSP Session updated before sendRedirect() lose their information - + 786 Buffering Response Handler - + 790 AsyncContentListener semantic broken with HTTP/2 transport - + 792 HTTP/2] Socket seems to be not closed completely - + 797 MimeTypes resource loading incorrect on OSGi - + 798 async IO Write closed race - + 804 setting default Url Encoding broken in Jetty >= 9.3 - + 806 Jetty HttpClient authentication - missing any realm option - + 817 NPE in jndi Resource - + 826 Better default for HTTP/2's max concurrent streams - + 827 HTTPClient fails connecting to HTTPS host through an HTTP proxy - w/authentication - + 830 Test webapp not properly copied to demo-base - + 832 ServerWithJNDI example uses wrong webapp - + 841 support reset in buffering interceptors - + 844 Implement a Thread Limit Handler - + 845 Improve blocking IO for data rate limiting - + 851 MBeanContainer no longer unregisters MBeans when "stopped" - + 854 If container.destroy() is called, calling container.start() again should - throw an IllegalStateException - + 855 JMXify MBeanContainer - + 860 Only TLS 1.2 Supported - + 868 ClassLoader leak with Jetty and Karaf - static instances of - java.lang.Throwable - + 880 Refactor jetty-http's HostPortHttpField logic into new jetty-util class - + 882 Add IPv6 support to IPAddressMap in jetty-util - + 889 ConstantThrowable.name can be removed - + 894 When adding servless class, preserve Class instead of going through - String - + 897 Remove GzipHandler interceptor when out of scope - + 898 GzipHandler adds multiple Vary header - + 902 Expect: 100-Continue does not work with HTTP/2 - + 909 Path and Domain not properly matched in addCookie() - + 911 Request.getRequestURI() gets decoded after startAsync(req, resp) is - invoked - + 913 Unprotected debug in WebAppClassLoader - + 922 Implements methods Connection.getBytes[In|Out]() - -jetty-9.3.11.v20160721 - 21 July 2016 - + 230 customize Content-Type in ErrorHandler's default error page - + 592 Support no-value Host header in HttpParser - + 631 SLOTH protection - + 649 LDAPLoginModule should disallow blank username and password - + 658 Add memcached option for gcloud-sessions in jetty-9.3 - + 660 NullPointerException in Request.getParameter: _parameters is null - + 663 Update gcloud datastore to 0.2.3 - + 667 Introduce optional `jetty.deploy.monitoredPath` for jetty-deploy paths - outside of ${jetty.base} - + 668 Introduce optional `jetty.deploy.defaultsDescriptorPath` for - jetty-deploy defaults descriptor outside of ${jetty.home} - + 669 Support UNC paths in PathResource - + 671 Incorrect ALPN default protocol - + 672 Allow logging configuration announcement to be programmatically disabled - + 673 ClasspathPattern needs a match all pattern - + 675 Slf4jLog.ignore() should produce at DEBUG level - + 676 JavaUtilLog.ignore() should produce at DEBUG level - + 677 Logging of .ignore() should indicate that it was an "Ignored Exception" - + 678 Log at less than DEBUG level when annotation scanning takes significant - time - + 682 Quickstart should not scan all container path jars - + 684 HttpClient proxies (HttpProxy and Socks4Proxy) do not support - authentication - + 685 SecureRequestCustomizer SSLSession attribute not set - + 687 AllowSymLinkAliasChecker not normalizing relative symlinks properly - + 690 jetty-maven-plugin does not configure AnnotationConfiguration for - jetty:effective-web-xml goal - + 695 Deprecate LocalConnector.getResponses() in favor of using .getResponse() - + 696 LocalConnector.getResponse() doesn't find close if using HTTP/1.1 - w/Connection: close - + 701 Document CachingWebAppClassLoader - + 706 org.apache.jasper.compiler.disablejsr199 is no longer present in Jetty - 9.3+ - + 708 SslContextFactory: newSslServerSocket/newSslSocket customization - + 717 GzipHandler.minGzipSize still compresses small responses - + 718 Document HttpClient transports - + 720 asciiToLowerCase throws NullPointerException - + 721 HTTP Response header value encoding is invalid for RFC7230 - + 723 Improve bad/missing mime.properties reporting - + 726 Http2 Client parse error - + 730 "Slow" client causes IllegalStateException - + 733 Allow setCharacterEncoding after getOutputStream - + 739 Illegal WindowUpdate frame with delta=0 - + 742 Fixed link to webtide.com - + 745 Removed README.txt - + 747 Update documentation to reflect TLS and SSL support - + 751 Remove usages of ArrayQueue - + 752 Implement support for HTTP2 SETTINGS_MAX_HEADER_LIST_SIZE - + 755 NPE in HttpChannelOverHTTP2.requestContent() - + 756 Filter problematic headers from CGI and FastCGIProxy - -jetty-9.2.19.v20160908 - 08 September 2016 - + 817 NPE in jndi Resource - + 830 Test webapp not properly copied to demo-base - + 832 ServerWithJNDI example uses wrong webapp - + 851 MBeanContainer no longer unregisters MBeans when "stopped" - + 868 ClassLoader leak with Jetty and Karaf - static instances of - java.lang.Throwable - + 880 Refactor jetty-http's HostPortHttpField logic into new jetty-util class - + 882 Add IPv6 support to IPAddressMap in jetty-util - + 894 When adding servless class, preserve Class instead of going through - String - -jetty-9.2.18.v20160721 - 21 July 2016 - + 425 Incorrect @ServerEndpoint Encoder/Decoder lifecycle - + 649 LDAPLoginModule should disallow blank username and password - + 654 Jetty 9.3 ServletContext.getResourceAsStream("/") returns an unusable - stream - + 661 JsrExtension is missing hashCode() and equals() - + 756 Filter problematic headers from CGI and FastCGIProxy - -jetty-9.3.11.M0 - 22 June 2016 - + 425 Incorrect @ServerEndpoint Encoder/Decoder lifecycle - + 624 AsyncContext.onCompleted called twice - + 645 jetty-requestlog.xml default log path - + 654 Jetty 9.3 ServletContext.getResourceAsStream("/") returns an unusable - stream - + 659 CONNECT request fails spuriously - + 660 NullPointerException in Request.getParameter: _parameters is null - + 661 JsrExtension is missing hashCode() and equals() - -jetty-9.3.10.v20160621 - 21 June 2016 - + 388 Add methods to send text frames with pre-encoded strings - + 605 Guard concurrent calls to WebSocketSession.close() - + 608 reset encoding set from content type? - + 620 Missing call to setPattern in RewritePatternRule constructor - + 623 Add --gzip suffix to 304 responses with ETAGs - + 624 AsyncContext.onCompleted called twice - + 628 IOException: Unable to open root Jar file - MetaInfConfiguration.getTlds(MetaInfConfiguration.java:406) with Spring boot - loader + WebAppContext + non-expanded war - + 633 If jmx and websocket is enabled, redploying a context produces a - NullPointerException - + 638 ConnectHandler responses should have Content-Length - + 639 ServerContainer stores WebSocket sessions twice - + 640 ClientContainer should store WebSocket sessions as beans - + 641 MongoSessionIdManager uses deprecated ensureIndex - + 647 HTTP/2 CONTINUATION frame parsing throws IllegalStateException - + 648 Problem using InputStreamResponseListener to handle HTTP/2 responses - jetty-9.3.10.M0 - 26 May 2016 + 354 Spin loop in case of exception thrown during accept() + 464 Improve reporting of SSLHandshakeException @@ -916,6 +937,7 @@ jetty-9.3.9.v20160517 - 17 May 2016 + 558 HTTP/2 server hangs when thread pool is low on threads + 560 Jetty Client Proxy Authentication does not work with HTTP Proxy tunneling + + 561 Fixed test timer + 567 NPE in ErrorPageErrorHandler debug + 570 URIUtil.encodePath does not always encode utf8 chars + 571 AbstractAuthentication.matchesURI() fails to match scheme @@ -961,6 +983,8 @@ jetty-9.3.9.M1 - 11 April 2016 + 418 Add osgi capability for endpoint configurator + 424 Jetty impl. of Websocket ServerEndpointConfig.Configurator lifecycle out of spec + + 427 Squelch intentional exceptions seen during websocket testing + + 434 RequestTest stack traces + 435 adjust debug log message + 437 Avoid NPE on receiving empty message though MessageHandler.Partial + 438 File and Path Resources with control characters should be rejected @@ -980,6 +1004,7 @@ jetty-9.3.9.M1 - 11 April 2016 + 476 HttpClient should not send absolute-form target with non HttpProxy jetty-9.3.8.v20160314 - 14 March 2016 + + 107 ResourceHandler range support testcase + 124 Don't produce text/html if the request doesn't accept it + 247 improving invalid buffer manipulation exception messages + 258 Http request to origin server over https proxy contains absolute URL @@ -988,6 +1013,8 @@ jetty-9.3.8.v20160314 - 14 March 2016 + 305 NPE when notifying the session listener if the channel is closed before a session has been opened + 316 Add *.chm mimetype mapping + + 343 ensure release deployment of test-jetty-webapp:war and + test-proxy-webapp:war + 346 HttpParser RFC2616 Compliance mode + 353 Jetty Client doesn't forward authentication headers with redirects when using proxy @@ -1006,6 +1033,7 @@ jetty-9.3.8.v20160314 - 14 March 2016 + 386 Explicit Authorization header is dropped when handling 407s + 397 Multipart EOF handling + 402 Don't use Thread.isAlive() in ShutdownMonitor + + 405 adding testcase for problematic HttpURI parsing of path params + 406 GzipHandler: allow to override the Vary response header + 407 JSR356 Server WebSocket Sessions no longer being tracked + 408 Http client does not work on https with proxy @@ -1100,6 +1128,7 @@ jetty-9.3.7.RC0 - 05 January 2016 + 482243 Fixed GzipHandler for Include + 482270 Expose upgrade request locales + 482272 Fixed relative symlink checking + + 482506 HTTP/2 load test with h2load fails + 482670 HttpURI wrongly parser URI paths starting with /@ + 482855 Content-Length omitted for POST requests with empty body + 482959 Local stream count never decrements when closing a stream causing @@ -1420,6 +1449,8 @@ jetty-9.3.0.v20150612 - 12 June 2015 + 452503 Start.jar --add-to-start=jstl results in GraphException: Unable to expand property in name: jsp-impl/${jsp-impl}-jstl + 453487 Recycle HttpChannelOverHTTP2 + + 453627 Fixed FileSystem test for nanosecond filesystems + + 453636 Improved spin detection on test + 453829 Added HeaderRegexRule + 453834 CDI Support for WebSocket + 454152 Remove mux remnants from WebSocketClient @@ -1430,6 +1461,7 @@ jetty-9.3.0.v20150612 - 12 June 2015 + 456956 Reduce ThreadLocal.remove() weak reference garbage + 457130 HTTPS request with IP host and HTTP proxy throws IllegalArgumentException. + + 457309 Add test to ensure GET and HEAD response headers same for gzip + 457508 Add flag to scan exploded jars in jetty-jspc-maven-plugin + 457788 Powered By in o.e.j.util.Jetty conditional on sendServerVersion + 458478 JarFileResource improve performance of exist method diff --git a/aggregates/jetty-all/pom.xml b/aggregates/jetty-all/pom.xml index 665303d7575..d20d594368e 100644 --- a/aggregates/jetty-all/pom.xml +++ b/aggregates/jetty-all/pom.xml @@ -2,108 +2,121 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../../pom.xml 4.0.0 org.eclipse.jetty.aggregate jetty-all Jetty :: Aggregate :: All core Jetty + UberJar for Core Jetty features + pom http://www.eclipse.org/jetty + + ${project.build.directory}/${project.artifactId}-${project.version}-uber.jar + ${project.build.directory}/gen-resources + - ${project.build.directory}/sources org.apache.maven.plugins - maven-dependency-plugin + maven-resources-plugin - unpack-dependencies + massage-manifest + generate-resources - unpack-dependencies + copy-resources - **/MANIFEST.MF,javax/** - javax - javax,org.eclipse.jetty.orbit,org.mortbay.jetty.npn,org.slf4j,org.ow2.asm - ${project.build.directory}/classes - false - true - - - - unpack-source - generate-sources - - unpack-dependencies - - - sources - **/* - META-INF/**,**/Servlet3Continuation*,**/Jetty6Continuation* - org.eclipse.jetty,org.eclipse.jetty.websocket - javax - javax,org.eclipse.jetty.orbit,org.mortbay.jetty.npn,org.slf4j,org.ow2.asm - ${project.build.directory}/sources - true - true - - - - - - org.apache.maven.plugins - - maven-jar-plugin - - - package - package - - jar - - - - - - - development - http://eclipse.org/jetty - ${user.name} - org.eclipse.jetty - http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/NOTICE.txt - Jetty - - + ${gen-resources-dir} + + + src/main/resources + true + + org.apache.maven.plugins - maven-javadoc-plugin + maven-shade-plugin + + + org.eclipse.jetty.toolchain + jetty-build-support + 1.3 + + - javadoc-jar - compile + uberjar + package - jar + shade + + true + uber + ${uber-jar} + + + + ${gen-resources-dir} + + + + + *:* + + META-INF/LICENSE.txt + META-INF/*.MF + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + javax:* + org.eclipse.jetty.orbit:* + org.mortbay.jetty:* + org.mortbay.jetty.alpn:* + org.slf4j:* + org.ow2.asm:* + *:javax + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + package + + attach-artifact + + + + + ${uber-jar} + jar + uber + + + - - - - org.apache.maven.plugins - maven-pmd-plugin - - true - - - - @@ -111,120 +124,109 @@ org.eclipse.jetty jetty-client ${project.version} - provided org.eclipse.jetty jetty-deploy ${project.version} - provided - - - org.eclipse.jetty.websocket - websocket-servlet - ${project.version} - provided - - - org.eclipse.jetty.websocket - javax-websocket-server-impl - ${project.version} - provided - - - org.eclipse.jetty.websocket - websocket-client - ${project.version} - provided - - - org.eclipse.jetty.spdy - spdy-http-server - ${project.version} - provided org.eclipse.jetty jetty-jmx ${project.version} - provided org.eclipse.jetty jetty-plus ${project.version} - provided org.eclipse.jetty jetty-annotations ${project.version} - provided org.eclipse.jetty jetty-util ${project.version} - provided org.eclipse.jetty jetty-jaspi ${project.version} - provided org.eclipse.jetty jetty-jndi ${project.version} - provided org.eclipse.jetty jetty-rewrite ${project.version} - provided org.eclipse.jetty jetty-servlets ${project.version} - provided org.eclipse.jetty jetty-quickstart ${project.version} - provided + + + + org.eclipse.jetty.websocket + websocket-servlet + ${project.version} + + + org.eclipse.jetty.websocket + javax-websocket-server-impl + ${project.version} + + + org.eclipse.jetty.websocket + websocket-client + ${project.version} + + + + org.eclipse.jetty + jetty-alpn-client + ${project.version} + + + org.eclipse.jetty.http2 + http2-server + ${project.version} + + + org.eclipse.jetty.http2 + http2-client + ${project.version} javax.websocket javax.websocket-api - compile javax.servlet javax.servlet-api - compile javax.transaction javax.transaction-api - compile - true org.eclipse.jetty.orbit javax.mail.glassfish - compile - true org.slf4j slf4j-api - compile - true diff --git a/apache-jsp/pom.xml b/apache-jsp/pom.xml index 2a4954a901c..d00dde77d83 100644 --- a/apache-jsp/pom.xml +++ b/apache-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 apache-jsp @@ -18,62 +18,32 @@ org.apache.felix maven-bundle-plugin true - - - generate-manifest - - manifest - Jetty-specific ServletContainerInitializer for Jasper - org.eclipse.jetty.apache.jsp.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}", + org.eclipse.jetty.apache.jsp.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}", org.eclipse.jetty.jsp.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)" - osgi.serviceloader; osgi.serviceloader=javax.servlet.ServletContainerInitializer + osgi.serviceloader;osgi.serviceloader=javax.servlet.ServletContainerInitializer,osgi.serviceloader;osgi.serviceloader=org.apache.juli.logging.Log <_nouses>true - - org.apache.maven.plugins maven-jar-plugin - artifact-jar + nolog-jar jar - - - test-jar - - test-jar - - - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - config - + nolog + + META-INF/services/org.apache.juli.logging.Log + @@ -94,12 +64,7 @@ jetty-util ${project.version} - - org.eclipse.jetty - jetty-server - ${project.version} - - + org.eclipse.jetty.toolchain @@ -120,8 +85,28 @@ - org.eclipse.jetty.orbit - org.eclipse.jdt.core + org.eclipse.jdt.core.compiler + ecj + + + + + org.eclipse.jetty + jetty-servlet + ${project.version} + tests + test + + + org.eclipse.jetty + jetty-servlet + ${project.version} + test + + + org.eclipse.jetty.toolchain + jetty-test-helper + test diff --git a/apache-jstl/pom.xml b/apache-jstl/pom.xml index 7301e4b853a..2de59430d77 100644 --- a/apache-jstl/pom.xml +++ b/apache-jstl/pom.xml @@ -2,32 +2,25 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 apache-jstl Apache :: JSTL module http://tomcat.apache.org/taglibs/standard/ jar + + ${project.groupId}.apache.jstl + - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - + org.apache.maven.plugins + maven-surefire-plugin + + false + org.jacoco @@ -51,6 +44,34 @@ org.apache.taglibs taglibs-standard-impl + + + org.eclipse.jetty.toolchain + jetty-test-helper + test + + + + org.eclipse.jetty + apache-jsp + ${project.version} + test + + + + org.eclipse.jetty + jetty-annotations + ${project.version} + test + + + + org.eclipse.jetty + jetty-webapp + ${project.version} + test + + diff --git a/examples/async-rest/async-rest-jar/pom.xml b/examples/async-rest/async-rest-jar/pom.xml index 987b7186c08..66dbe8f7b58 100644 --- a/examples/async-rest/async-rest-jar/pom.xml +++ b/examples/async-rest/async-rest-jar/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty example-async-rest - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 org.eclipse.jetty.example-async-rest @@ -10,6 +10,9 @@ jar Example Async Rest :: Jar http://www.eclipse.org/jetty + + ${project.groupId}.examples.asyc.rest + org.eclipse.jetty diff --git a/examples/async-rest/async-rest-webapp/pom.xml b/examples/async-rest/async-rest-webapp/pom.xml index e7dfc982480..ebc71af66d9 100644 --- a/examples/async-rest/async-rest-webapp/pom.xml +++ b/examples/async-rest/async-rest-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty example-async-rest - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 org.eclipse.jetty.example-async-rest diff --git a/examples/async-rest/pom.xml b/examples/async-rest/pom.xml index 8fb25470bee..73ae49e27e9 100644 --- a/examples/async-rest/pom.xml +++ b/examples/async-rest/pom.xml @@ -2,9 +2,9 @@ org.eclipse.jetty.examples examples-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml - + 4.0.0 org.eclipse.jetty example-async-rest diff --git a/examples/embedded/pom.xml b/examples/embedded/pom.xml index a743a3ccafa..adc1b4d984c 100644 --- a/examples/embedded/pom.xml +++ b/examples/embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.examples examples-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml 4.0.0 @@ -11,7 +11,17 @@ Example :: Jetty Embedded Jetty Embedded Examples http://www.eclipse.org/jetty + + ${project.groupId}.embedded + + + + com.google.guava + guava + 18.0 + + org.eclipse.jetty jetty-util-ajax @@ -37,6 +47,11 @@ jetty-deploy ${project.version} + + org.eclipse.jetty + jetty-rewrite + ${project.version} + org.eclipse.jetty jetty-jmx @@ -53,8 +68,18 @@ ${project.version} - org.eclipse.jetty.spdy - spdy-http-server + org.eclipse.jetty.http2 + http2-server + ${project.version} + + + org.eclipse.jetty.alpn + alpn-api + ${alpn.api.version} + + + org.eclipse.jetty + jetty-alpn-server ${project.version} @@ -105,5 +130,12 @@ jetty-test-helper + + org.eclipse.jetty + jetty-http + ${project.version} + tests + test + diff --git a/examples/pom.xml b/examples/pom.xml index 3045a9ed631..ada149dc692 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -1,27 +1,10 @@ - 4.0.0 org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml org.eclipse.jetty.examples @@ -42,7 +25,7 @@ async-rest diff --git a/jetty-alpn/jetty-alpn-client/pom.xml b/jetty-alpn/jetty-alpn-client/pom.xml index 360fcc813e2..436d7a06aa2 100644 --- a/jetty-alpn/jetty-alpn-client/pom.xml +++ b/jetty-alpn/jetty-alpn-client/pom.xml @@ -2,13 +2,11 @@ org.eclipse.jetty jetty-alpn-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-alpn-client - Jetty :: ALPN Client - Jetty ALPN client services - http://www.eclipse.org/jetty + Jetty :: ALPN :: Client ${project.groupId}.alpn.client @@ -31,15 +29,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - diff --git a/jetty-alpn/jetty-alpn-server/pom.xml b/jetty-alpn/jetty-alpn-server/pom.xml index e3942baa3c7..cb0073849a9 100644 --- a/jetty-alpn/jetty-alpn-server/pom.xml +++ b/jetty-alpn/jetty-alpn-server/pom.xml @@ -2,62 +2,16 @@ org.eclipse.jetty jetty-alpn-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-alpn-server - Jetty :: ALPN Server - Jetty ALPN server services - http://www.eclipse.org/jetty + Jetty :: ALPN :: Server ${project.groupId}.alpn.server - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - org.eclipse.jetty.alpn,* - <_nouses>true - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - @@ -71,6 +25,32 @@ org.eclipse.jetty.alpn.* + + org.codehaus.mojo + build-helper-maven-plugin + + + parse-version + + parse-version + + + alpn + ${alpn.api.version} + + + + + + org.apache.felix + maven-bundle-plugin + + + ${bundle-symbolic-name};singleton:=true + org.eclipse.jetty.alpn;version="${alpn.majorVersion}.${alpn.minorVersion}.${alpn.incrementalVersion}",* + + + diff --git a/jetty-alpn/jetty-alpn-server/src/main/config/modules/alpn-impl/alpn-1.8.0_144.mod b/jetty-alpn/jetty-alpn-server/src/main/config/modules/alpn-impl/alpn-1.8.0_144.mod index 4eb78ef5fb2..eb50f520252 100644 --- a/jetty-alpn/jetty-alpn-server/src/main/config/modules/alpn-impl/alpn-1.8.0_144.mod +++ b/jetty-alpn/jetty-alpn-server/src/main/config/modules/alpn-impl/alpn-1.8.0_144.mod @@ -1,6 +1,3 @@ -[name] -alpn-boot - [files] http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.11.v20170118/alpn-boot-8.1.11.v20170118.jar|lib/alpn/alpn-boot-8.1.11.v20170118.jar diff --git a/jetty-alpn/pom.xml b/jetty-alpn/pom.xml index 64186420ef4..1bba2c7810c 100644 --- a/jetty-alpn/pom.xml +++ b/jetty-alpn/pom.xml @@ -1,17 +1,29 @@ - + org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-alpn-parent pom Jetty :: ALPN :: Parent - Jetty ALPN services parent - http://www.eclipse.org/jetty jetty-alpn-server jetty-alpn-client + + + jdk9 + + [1.9,) + + + jetty-alpn-java-client + jetty-alpn-java-server + + + diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index effd2fd02ad..6eae9da4656 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-annotations @@ -14,53 +14,15 @@ - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - org.apache.felix maven-bundle-plugin true - - - generate-manifest - - manifest - - javax.servlet.*;version="[2.6.0,3.2)",org.objectweb.asm.*;version=5,* osgi.serviceloader; filter:="(osgi.serviceloader=javax.servlet.ServletContainerInitializer)";resolution:=optional;cardinality:=multiple, osgi.extender; filter:="(osgi.extender=osgi.serviceloader.processor)" - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - org.codehaus.mojo diff --git a/jetty-ant/pom.xml b/jetty-ant/pom.xml index bec996c369b..41444181f21 100644 --- a/jetty-ant/pom.xml +++ b/jetty-ant/pom.xml @@ -2,13 +2,16 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-ant jar Jetty :: Ant Plugin + + org.eclipse.jetty.ant + @@ -22,8 +25,8 @@ org.eclipse.jetty - org.eclipse.jetty.orbit,org.eclipse.jetty.spdy,org.eclipse.jetty.websocket,org.eclipse.jetty.drafts - jetty-all,jetty-start,jetty-monitor,jetty-jsp + org.eclipse.jetty.orbit,org.eclipse.jetty.websocket,org.eclipse.jetty.drafts + jetty-all,jetty-start jar ${project.build.directory}/test-lib diff --git a/jetty-bom/pom.xml b/jetty-bom/pom.xml index edcbfcac85e..9b8ad9eafbb 100644 --- a/jetty-bom/pom.xml +++ b/jetty-bom/pom.xml @@ -146,11 +146,6 @@ cdi-servlet ${project.version} - - org.eclipse.jetty.cdi - cdi-websocket - ${project.version} - org.eclipse.jetty jetty-client diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 968598327c6..c5009680e62 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 @@ -15,50 +15,6 @@ - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.net.*,* - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.codehaus.mojo findbugs-maven-plugin @@ -92,6 +48,43 @@ + + org.apache.maven.plugins + maven-shade-plugin + + + package + + shade + + + true + hybrid + + + org.eclipse.jetty:jetty-http + org.eclipse.jetty:jetty-io + org.eclipse.jetty:jetty-util + + + + + org.eclipse.jetty.http + org.eclipse.jetty.client.shaded.http + + + org.eclipse.jetty.io + org.eclipse.jetty.client.shaded.io + + + org.eclipse.jetty.util + org.eclipse.jetty.client.shaded.util + + + + + + diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpChannelOverHTTP.java b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpChannelOverHTTP.java index 3153a20ba5e..d4d14dc3f7d 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpChannelOverHTTP.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpChannelOverHTTP.java @@ -31,6 +31,7 @@ import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpHeaderValue; import org.eclipse.jetty.http.HttpMethod; +import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpVersion; public class HttpChannelOverHTTP extends HttpChannel @@ -142,6 +143,8 @@ public class HttpChannelOverHTTP extends HttpChannel closeReason = "failure"; else if (receiver.isShutdown()) closeReason = "server close"; + else if (sender.isShutdown()) + closeReason = "client close"; if (closeReason == null) { @@ -156,7 +159,7 @@ public class HttpChannelOverHTTP extends HttpChannel } else { - // HTTP 1.1 or greater closes only if it has an explicit close. + // HTTP 1.1 closes only if it has an explicit close. if (responseHeaders.contains(HttpHeader.CONNECTION, HttpHeaderValue.CLOSE.asString())) closeReason = "http/1.1"; } @@ -170,7 +173,10 @@ public class HttpChannelOverHTTP extends HttpChannel } else { - release(); + if (response.getStatus() == HttpStatus.SWITCHING_PROTOCOLS_101) + connection.remove(); + else + release(); } } diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java index 0a993756633..b2c7751a537 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpClientTest.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpCookie; +import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.URI; @@ -1581,62 +1582,86 @@ public class HttpClientTest extends AbstractHttpClientServerTest } @Test - public void testCONNECTWithHTTP10() throws Exception + public void testCopyRequest() throws Exception { - try (ServerSocket server = new ServerSocket(0)) + startClient(); + + assertCopyRequest(client.newRequest("http://example.com/some/url") + .method(HttpMethod.HEAD) + .version(HttpVersion.HTTP_2) + .content(new StringContentProvider("some string")) + .timeout(321, TimeUnit.SECONDS) + .idleTimeout(2221, TimeUnit.SECONDS) + .followRedirects(true) + .header(HttpHeader.CONTENT_TYPE, "application/json") + .header("X-Some-Custom-Header", "some-value")); + + assertCopyRequest(client.newRequest("https://example.com") + .method(HttpMethod.POST) + .version(HttpVersion.HTTP_1_0) + .content(new StringContentProvider("some other string")) + .timeout(123231, TimeUnit.SECONDS) + .idleTimeout(232342, TimeUnit.SECONDS) + .followRedirects(false) + .header(HttpHeader.ACCEPT, "application/json") + .header("X-Some-Other-Custom-Header", "some-other-value")); + + assertCopyRequest(client.newRequest("https://example.com") + .header(HttpHeader.ACCEPT, "application/json") + .header(HttpHeader.ACCEPT, "application/xml") + .header("x-same-name", "value1") + .header("x-same-name", "value2")); + + assertCopyRequest(client.newRequest("https://example.com") + .header(HttpHeader.ACCEPT, "application/json") + .header(HttpHeader.CONTENT_TYPE, "application/json")); + + assertCopyRequest(client.newRequest("https://example.com") + .header("Accept", "application/json") + .header("Content-Type", "application/json")); + + assertCopyRequest(client.newRequest("https://example.com") + .header("X-Custom-Header-1", "value1") + .header("X-Custom-Header-2", "value2")); + + assertCopyRequest(client.newRequest("https://example.com") + .header("X-Custom-Header-1", "value") + .header("X-Custom-Header-2", "value")); + } + + @Test + public void testHostWithHTTP10() throws Exception + { + start(new AbstractHandler() { - startClient(); - - String host = "localhost"; - int port = server.getLocalPort(); - - Request request = client.newRequest(host, port) - .method(HttpMethod.CONNECT) - .version(HttpVersion.HTTP_1_0); - FuturePromise promise = new FuturePromise<>(); - client.getDestination("http", host, port).newConnection(promise); - Connection connection = promise.get(5, TimeUnit.SECONDS); - FutureResponseListener listener = new FutureResponseListener(request); - connection.send(request, listener); - - try (Socket socket = server.accept()) + @Override + public void handle(String target, org.eclipse.jetty.server.Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - InputStream input = socket.getInputStream(); - consume(input, false); - - // HTTP/1.0 response, the client must not close the connection. - String httpResponse = "" + - "HTTP/1.0 200 OK\r\n" + - "\r\n"; - OutputStream output = socket.getOutputStream(); - output.write(httpResponse.getBytes(StandardCharsets.UTF_8)); - output.flush(); - - ContentResponse response = listener.get(5, TimeUnit.SECONDS); - Assert.assertEquals(200, response.getStatus()); - - // Because the tunnel was successful, this connection will be - // upgraded to an SslConnection, so it will not be fill interested. - // This test doesn't upgrade, so it needs to restore the fill interest. - ((AbstractConnection)connection).fillInterested(); - - // Test that I can send another request on the same connection. - request = client.newRequest(host, port); - listener = new FutureResponseListener(request); - connection.send(request, listener); - - consume(input, false); - - httpResponse = "" + - "HTTP/1.1 200 OK\r\n" + - "Content-Length: 0\r\n" + - "\r\n"; - output.write(httpResponse.getBytes(StandardCharsets.UTF_8)); - output.flush(); - - listener.get(5, TimeUnit.SECONDS); + baseRequest.setHandled(true); + Assert.assertThat(request.getHeader("Host"), Matchers.notNullValue()); } - } + }); + + ContentResponse response = client.newRequest("localhost", connector.getLocalPort()) + .scheme(scheme) + .version(HttpVersion.HTTP_1_0) + .timeout(5, TimeUnit.SECONDS) + .send(); + + Assert.assertEquals(200, response.getStatus()); + } + + private void assertCopyRequest(Request original) + { + Request copy = client.copyRequest((HttpRequest) original, original.getURI()); + Assert.assertEquals(original.getURI(), copy.getURI()); + Assert.assertEquals(original.getMethod(), copy.getMethod()); + Assert.assertEquals(original.getVersion(), copy.getVersion()); + Assert.assertEquals(original.getContent(), copy.getContent()); + Assert.assertEquals(original.getIdleTimeout(), copy.getIdleTimeout()); + Assert.assertEquals(original.getTimeout(), copy.getTimeout()); + Assert.assertEquals(original.isFollowRedirects(), copy.isFollowRedirects()); + Assert.assertEquals(original.getHeaders(), copy.getHeaders()); } private void consume(InputStream input, boolean eof) throws IOException diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index b8feada6f57..134fa182c39 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-continuation @@ -14,35 +14,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.codehaus.mojo findbugs-maven-plugin diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 0b8e780c2c9..a118eb6b171 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-deploy @@ -14,53 +14,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - org.eclipse.jetty.jmx.*;version="9.1";resolution:=optional,* - <_nouses>true - - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.codehaus.mojo findbugs-maven-plugin diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 3756b100a0c..3df837a0f44 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -1,27 +1,35 @@ - - 4.0.0 + org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT + 4.0.0 jetty-distribution Jetty :: Distribution Assemblies - http://www.eclipse.org/jetty pom + ${basedir}/target/distribution - 1.0.1 + ${basedir}/target/home + + org.apache.maven.plugins maven-resources-plugin copy-base-assembly-tree - generate-resources + process-resources copy-resources @@ -68,6 +76,18 @@ + + removeKeystore + process-resources + + run + + + + + + + @@ -91,24 +111,39 @@ maven-dependency-plugin + - copy + unpack-jetty-home generate-resources - copy + unpack org.eclipse.jetty - jetty-project + jetty-home ${project.version} - version - txt + zip true - ${assembly-directory}/ - VERSION.txt + ${home-directory} + + META-INF/** + + + + + copy + process-resources + + copy + + + org.eclipse.jetty test-jetty-webapp @@ -169,80 +204,11 @@ ${assembly-directory}/demo-base/webapps async-rest.war - - org.eclipse.jetty - jetty-start - ${project.version} - jar - true - ** - ${assembly-directory} - start.jar - - - - - - copy-setuid-deps - generate-resources - - copy - - - - - org.eclipse.jetty.toolchain.setuid - jetty-setuid-java - ${jetty-setuid-version} - jar - true - ${assembly-directory}/lib/setuid - - - org.eclipse.jetty.toolchain.setuid - libsetuid-linux - ${jetty-setuid-version} - so - true - ${assembly-directory}/lib/setuid - libsetuid-linux.so - - - org.eclipse.jetty.toolchain.setuid - libsetuid-osx - ${jetty-setuid-version} - so - true - ${assembly-directory}/lib/setuid - libsetuid-osx.so - - unpack-setuid-config - process-resources - - unpack - - - - - org.eclipse.jetty.toolchain.setuid - jetty-setuid-java - ${jetty-setuid-version} - config - jar - true - ${assembly-directory} - - - META-INF/** - - - - unpack-test-webapp-config process-resources @@ -329,272 +295,35 @@ META-INF/** - - copy-lib-deps - generate-resources + unpack-documentation + process-resources - copy-dependencies - - - org.eclipse.jetty - org.eclipse.jetty.orbit,org.eclipse.jetty.spdy,org.eclipse.jetty.websocket,org.eclipse.jetty.fcgi,org.eclipse.jetty.toolchain,org.apache.taglibs - jetty-all,jetty-jsp,apache-jsp,apache-jstl,jetty-start,jetty-monitor,jetty-spring - jar - ${assembly-directory}/lib - - - - copy-lib-websocket-deps - generate-resources - - copy-dependencies - - - javax.websocket,org.eclipse.jetty.websocket - javax.websocket-client-api - jar - ${assembly-directory}/lib/websocket - - - - copy-lib-fcgi-deps - generate-resources - - copy-dependencies - - - org.eclipse.jetty.fcgi - jar - ${assembly-directory}/lib/fcgi - - - - copy-lib-spring-deps - generate-resources - - copy-dependencies - - - org.eclipse.jetty - jetty-spring - jar - ${assembly-directory}/lib/spring - - - - copy-lib-monitor-deps - generate-resources - - copy + unpack org.eclipse.jetty - jetty-monitor + jetty-documentation ${project.version} - jar + html + zip true - ${assembly-directory}/lib/monitor + ${assembly-directory}/demo-base/webapps/doc - - copy-servlet-api-deps - generate-resources - - copy - - - - - javax.servlet - javax.servlet-api - 3.1.0 - true - ${assembly-directory}/lib - servlet-api-3.1.jar - - - org.eclipse.jetty.toolchain - jetty-schemas - 3.1.M0 - true - ${assembly-directory}/lib - jetty-schemas-3.1.jar - - - - - - unpack-spdy - process-resources - - unpack-dependencies - - - org.eclipse.jetty.spdy - config - false - META-INF/** - ${assembly-directory} - - - - copy-lib-spdy-deps - process-resources - - copy-dependencies - - - org.eclipse.jetty.spdy - jar - ${assembly-directory}/lib/spdy - - - - copy-annotations-deps - generate-resources - - copy-dependencies - - - javax.annotation,org.eclipse.jetty.orbit,org.ow2.asm - javax.annotation-api,asm,asm-commons - jar - ${assembly-directory}/lib/annotations - - - - - copy-jta-deps - generate-resources - - copy-dependencies - - - javax.transaction - javax.transaction-api - jar - ${assembly-directory}/lib/jndi - - - - copy-jndi-deps - generate-resources - - copy-dependencies - - - org.eclipse.jetty.orbit - javax.mail.glassfish - jar - ${assembly-directory}/lib/jndi - - - - copy-glassfish-jsp-deps - generate-resources - - copy-dependencies - - - org.eclipse.jetty.orbit,org.glassfish.web, org.glassfish, javax.el, javax.servlet.jsp, org.eclipse.jetty.toolchain, org.eclipse.jetty - org.eclipse.jdt.core, javax.servlet.jsp-api, javax.servlet.jsp, jetty-jsp-jdt, javax.el-api, javax.el, jetty-jsp - jar - ${assembly-directory}/lib/jsp - - - - copy-apache-jsp-deps - generate-resources - - copy-dependencies - - - org.eclipse.jetty,org.eclipse.jetty.toolchain,org.mortbay.jasper,org.eclipse.jetty.orbit - apache-jsp,apache-el,org.eclipse.jdt.core - jar - true - ${assembly-directory}/lib/apache-jsp - - - - copy-jstl-api - generate-resources - - copy-dependencies - - - org.eclipse.jetty.orbit - javax.servlet.jsp.jstl - true - jar - ${assembly-directory}/lib/jsp - - - - copy-jstl-impl - generate-resources - - copy-dependencies - - - org.glassfish.web - javax.servlet.jsp.jstl - jar - ${assembly-directory}/lib/jsp - - - - copy-apache-jstl-deps - generate-resources - - copy-dependencies - - - org.glassfish.web - taglibs-standard-spec,taglibs-standard-impl - true - jar - ${assembly-directory}/lib/apache-jstl - - - - copy-jaspi-deps - generate-resources - - copy-dependencies - - - org.eclipse.jetty.orbit - javax.security.auth.message - jar - ${assembly-directory}/lib/jaspi - - - - unpack-config-deps - generate-resources - - unpack-dependencies - - - org.eclipse.jetty,org.eclipse.jetty.websocket - config - false - META-INF/** - ${assembly-directory} - - org.codehaus.mojo exec-maven-plugin + setup home process-classes @@ -610,16 +339,18 @@ java + - setup demo-base + setup demo-base-startd process-classes org.eclipse.jetty.start.Main jetty.home=${assembly-directory} jetty.base=${assembly-directory}/demo-base - --add-to-start=server,continuation,deploy,websocket,ext,resources,client,annotations,jndi,servlets - --add-to-startd=jsp,jstl,http,https + --add-to-startd=server,continuation,deploy,websocket,ext,resources,client,annotations,jndi,servlets,jsp,jstl,http,https @@ -665,62 +396,13 @@ + - - - org.eclipse.jetty.orbit - javax.mail.glassfish - - - org.eclipse.jetty.orbit - javax.security.auth.message - - - - javax.annotation - javax.annotation-api - - - javax.transaction - javax.transaction-api - - - - org.glassfish.web - javax.servlet.jsp.jstl - - - - org.glassfish.web - javax.servlet.jsp - - - org.eclipse.jetty.toolchain - jetty-jsp-jdt - - - javax.servlet.jsp - javax.servlet.jsp-api - - - org.glassfish - javax.el - - - - org.ow2.asm - asm - - - org.ow2.asm - asm-commons - - - org.eclipse.jetty - jetty-deploy + jetty-home ${project.version} + pom org.eclipse.jetty @@ -734,159 +416,6 @@ war ${project.version} - - org.eclipse.jetty - jetty-jmx - ${project.version} - - - org.eclipse.jetty - jetty-monitor - ${project.version} - - - org.eclipse.jetty - jetty-quickstart - ${project.version} - - - org.eclipse.jetty - jetty-start - ${project.version} - - - org.eclipse.jetty - jetty-servlets - ${project.version} - - - org.eclipse.jetty.websocket - websocket-servlet - ${project.version} - - - org.eclipse.jetty.websocket - websocket-server - ${project.version} - - - org.eclipse.jetty.websocket - javax-websocket-server-impl - ${project.version} - - - org.eclipse.jetty - jetty-jsp - ${project.version} - - - org.eclipse.jetty - apache-jsp - ${project.version} - - - org.eclipse.jetty - apache-jstl - ${project.version} - - - org.eclipse.jetty - jetty-plus - ${project.version} - - - org.eclipse.jetty - jetty-client - ${project.version} - - - org.eclipse.jetty - jetty-continuation - ${project.version} - - - org.eclipse.jetty - jetty-proxy - ${project.version} - - - org.eclipse.jetty.fcgi - fcgi-server - ${project.version} - - - org.eclipse.jetty - jetty-spring - ${project.version} - - - - org.eclipse.jetty - jetty-cdi - ${project.version} - - - org.eclipse.jetty - jetty-jaas - ${project.version} - - - org.eclipse.jetty - jetty-annotations - ${project.version} - - - org.eclipse.jetty - jetty-rewrite - ${project.version} - - - org.eclipse.jetty.spdy - spdy-core - ${project.version} - - - org.eclipse.jetty.spdy - spdy-server - ${project.version} - - - org.eclipse.jetty.spdy - spdy-http-server - ${project.version} - - - org.eclipse.jetty.spdy - spdy-example-webapp - ${project.version} - war - - - org.eclipse.jetty - jetty-infinispan - ${project.version} - - - org.eclipse.jetty - jetty-hazelcast - ${project.version} - - - org.eclipse.jetty.gcloud - jetty-gcloud-session-manager - ${project.version} - - - org.eclipse.jetty.gcloud - jetty-gcloud-memcached-session-manager - ${project.version} - org.eclipse.jetty.example-async-rest example-async-rest-webapp @@ -895,8 +424,10 @@ org.eclipse.jetty - jetty-jaspi + jetty-documentation ${project.version} + html + zip diff --git a/jetty-documentation/src/main/asciidoc/administration/sessions/chapter.adoc b/jetty-documentation/src/main/asciidoc/administration/sessions/chapter.adoc index ddd13a71721..6f36fb4d379 100644 --- a/jetty-documentation/src/main/asciidoc/administration/sessions/chapter.adoc +++ b/jetty-documentation/src/main/asciidoc/administration/sessions/chapter.adoc @@ -17,10 +17,24 @@ [[session-management]] == Session Management -include::setting-session-characteristics.adoc[] -include::using-persistent-sessions.adoc[] -include::session-clustering-jdbc.adoc[] -include::session-clustering-mongodb.adoc[] -include::session-clustering-infinispan.adoc[] +Sessions are a concept within the Servlet api which allow requests to store and retrieve information across the time a user spends in an application. +Choosing the correct session manager implementation is an important consideration for every application as each can fit and perform optimally in different situations. +If you need a simple in-memory session manager that can persist to disk then session management using the local file system can be a good place to start. +If you need a session manager that can work in a clustered scenario with multiple instances of Jetty, then the JDBC session manager can be an excellent option. +Jetty also offers more niche session managers that leverage backends such as MongoDB, Inifinispan, or even Google's Cloud Data Store. + +include::session-hierarchy.adoc[] +include::sessions-details.adoc[] +include::session-configuration-memory.adoc[] +include::session-configuration-file-system.adoc[] +include::session-configuration-jdbc.adoc[] +include::session-configuration-mongodb.adoc[] +include::session-configuration-infinispan.adoc[] include::session-configuration-hazelcast.adoc[] -include::session-clustering-gcloud-datastore.adoc[] \ No newline at end of file +include::session-configuration-gcloud.adoc[] +//include::setting-session-characteristics.adoc[] +//include::using-persistent-sessions.adoc[] +//include::session-clustering-jdbc.adoc[] +//include::session-clustering-mongodb.adoc[] +//include::session-clustering-infinispan.adoc[] +//include::session-clustering-gcloud-datastore.adoc[] diff --git a/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc b/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc index e95a91a58c8..a424404e149 100644 --- a/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc +++ b/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc @@ -27,7 +27,7 @@ When using the Jetty distribution, you will first need to enable the `session-st mb-olamy:tmp-base olamy$ java -jar ../start.jar --create-startd MKDIR : ${jetty.base}/start.d INFO : Base directory was modified -mb-olamy:tmp-base olamy$ java -jar ../start.jar --add-to-start=hazelcast-remote-sessions +mb-olamy:tmp-base olamy$ java -jar ../start.jar --add-to-start=session-store-hazelcast-remote ALERT: There are enabled module(s) with licenses. The following 1 module(s): @@ -35,17 +35,21 @@ The following 1 module(s): + contains software not covered by the Eclipse Public License! + has not been audited for compliance with its license - Module: hazelcast-remote-sessions + Module: session-store-hazelcast-remote + Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license. + https://hazelcast.org/ + http://www.apache.org/licenses/LICENSE-2.0.html Proceed (y/N)? y -INFO: hazelcast-remote-sessions initialised in ${jetty.base}/start.ini -COPY: /Users/olamy/repository/com/hazelcast/hazelcast-all/3.8.2/hazelcast-all-3.8.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-all-3.8.2.jar -COPY: /Users/olamy/repository/com/hazelcast/hazelcast-jetty9-sessionmanager/1.0.2/hazelcast-jetty9-sessionmanager-1.0.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-jetty9-sessionmanager-1.0.2.jar -COPY: /Users/olamy/repository/org/eclipse/jetty/jetty-nosql/9.3.21-SNAPSHOT/jetty-nosql-9.3.21-SNAPSHOT.jar to ${jetty.base}/lib/hazelcast/jetty-nosql-9.3.21-SNAPSHOT.jar -INFO: Base directory was modified +INFO : server transitively enabled, ini template available with --add-to-start=server +INFO : sessions transitively enabled, ini template available with --add-to-start=sessions +INFO : session-store-hazelcast-remote initialized in ${jetty.base}/start.d/session-store-hazelcast-remote.ini +MKDIR : /Users/olamy/mvn-repo/com/hazelcast/hazelcast/3.8.2 +DOWNLD: http://central.maven.org/maven2/com/hazelcast/hazelcast/3.8.2/hazelcast-3.8.2.jar to /Users/olamy/mvn-repo/com/hazelcast/hazelcast/3.8.2/hazelcast-3.8.2.jar +MKDIR : ${jetty.base}/lib/hazelcast +COPY : /Users/olamy/mvn-repo/com/hazelcast/hazelcast/3.8.2/hazelcast-3.8.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-3.8.2.jar +COPY : /Users/olamy/mvn-repo/com/hazelcast/hazelcast-client/3.8.2/hazelcast-client-3.8.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-client-3.8.2.jar +INFO : Base directory was modified ---- Doing this enables the remote Hazelcast Session module and any dependent modules or files needed for it to run on the server. @@ -64,19 +68,42 @@ ____ ==== Configuring Hazelcast Remote Properties -Opening the `start.ini` will show a list of all the configurable options for the Hazelcast module: +Opening the `start.d/session-store-hazelcast-remote.ini` will show a list of all the configurable options for the Hazelcast module: [source, screen, subs="{sub-order}"] ---- # --------------------------------------- # Module: session-store-hazelcast-remote +# Enables session data store in a remote Hazelcast Map +# --------------------------------------- --module=session-store-hazelcast-remote +#jetty.session.hazelcast.mapName=jetty_sessions +#jetty.session.hazelcast.onlyClient=true #jetty.session.hazelcast.configurationLocation= +#jetty.session.gracePeriod.seconds=3600 +#jetty.session.savePeriod.seconds=0 ---- +jetty.session.hazelcast.mapName:: +Name of the Map in Hazelcast where sessions will be stored. +jetty.session.hazelcast.onlyClient:: +Hazelcast instance will be configured in client mode jetty.session.hazelcast.configurationLocation:: Path to an an Hazelcast xml configuration file +jetty.session.gracePeriod.seconds:: +Amount of time, in seconds, to wait for other nodes to be checked to verify an expired session is in fact expired throughout the cluster before closing it. +jetty.session.savePeriod.seconds=0:: +By default whenever the last concurrent request leaves a session, that session is always persisted via the `SessionDataStore`, even if the only thing that changed on the session is its updated last access time. +A non-zero value means that the `SessionDataStore` will skip persisting the session if only the access time changed, and it has been less than `savePeriod` seconds since the last time the session was written. ++ +____ +[NOTE] +Configuring `savePeriod` is useful if your persistence technology is very slow/costly for writes. +In a clustered environment, there is a risk of the last access time of the session being out-of-date in the shared store for up to `savePeriod` seconds. +This allows the possibility that a node may prematurely expire the session, even though it is in use by another node. +Thorough consideration of the `maxIdleTime` of the session when setting the `savePeriod` is imperative - there is no point in setting a `savePeriod` that is larger than the `maxIdleTime`. +____ ==== Configuring Embedded Hazelcast Clustering @@ -88,7 +115,7 @@ To enable this you will first need to enable the `session-store-hazelcast-embedd mb-olamy:tmp-base olamy$ java -jar ../start.jar --create-startd MKDIR : ${jetty.base}/start.d INFO : Base directory was modified -mb-olamy:tmp-base olamy$ java -jar ../start.jar --add-to-start=hazelcast-embedded-sessions +mb-olamy:tmp-base olamy$ java -jar ../start.jar --add-to-start=session-store-hazelcast-embedded ALERT: There are enabled module(s) with licenses. The following 1 module(s): @@ -96,17 +123,20 @@ The following 1 module(s): + contains software not covered by the Eclipse Public License! + has not been audited for compliance with its license - Module: hazelcast-embedded-sessions + Module: session-store-hazelcast-embedded + Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license. + https://hazelcast.org/ + http://www.apache.org/licenses/LICENSE-2.0.html Proceed (y/N)? y -INFO: hazelcast-embedded-sessions initialised in ${jetty.base}/start.ini -COPY: /Users/olamy/repository/com/hazelcast/hazelcast-all/3.8.2/hazelcast-all-3.8.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-all-3.8.2.jar -COPY: /Users/olamy/repository/com/hazelcast/hazelcast-jetty9-sessionmanager/1.0.2/hazelcast-jetty9-sessionmanager-1.0.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-jetty9-sessionmanager-1.0.2.jar -COPY: /Users/olamy/repository/org/eclipse/jetty/jetty-nosql/9.3.21-SNAPSHOT/jetty-nosql-9.3.21-SNAPSHOT.jar to ${jetty.base}/lib/hazelcast/jetty-nosql-9.3.21-SNAPSHOT.jar -INFO: Base directory was modified +INFO : server transitively enabled, ini template available with --add-to-start=server +INFO : sessions transitively enabled, ini template available with --add-to-start=sessions +INFO : session-store-hazelcast-embedded initialized in ${jetty.base}/start.d/session-store-hazelcast-embedded.ini +MKDIR : /Users/olamy/mvn-repo/com/hazelcast/hazelcast/3.8.2 +DOWNLD: http://central.maven.org/maven2/com/hazelcast/hazelcast/3.8.2/hazelcast-3.8.2.jar to /Users/olamy/mvn-repo/com/hazelcast/hazelcast/3.8.2/hazelcast-3.8.2.jar +MKDIR : ${jetty.base}/lib/hazelcast +COPY : /Users/olamy/mvn-repo/com/hazelcast/hazelcast/3.8.2/hazelcast-3.8.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-3.8.2.jar +COPY : /Users/olamy/mvn-repo/com/hazelcast/hazelcast-client/3.8.2/hazelcast-client-3.8.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-client-3.8.2.jar ---- Doing this enables the embedded Hazelcast Session module and any dependent modules or files needed for it to run on the server. @@ -120,15 +150,35 @@ In addition to adding these modules to the classpath of the server it also added ==== Configuring Hazelcast Embedded Properties -Opening the `start.ini` will show a list of all the configurable options for the Hazelcast module: +Opening the `start.d/start.d/session-store-hazelcast-embedded.ini` will show a list of all the configurable options for the Hazelcast module: [source, screen, subs="{sub-order}"] ---- # --------------------------------------- -# Module: hazelcast-embedded-sessions ---module=hazelcast-embedded-sessions +# Module: session-store-hazelcast-embedded +# Enables session data store in an embedded Hazelcast Map +# --------------------------------------- +--module=session-store-hazelcast-embedded +#jetty.session.hazelcast.mapName=jetty_sessions #jetty.session.hazelcast.configurationLocation= +#jetty.session.gracePeriod.seconds=3600 +#jetty.session.savePeriod.seconds=0 ---- +jetty.session.hazelcast.mapName:: +Name of the Map in Hazelcast where sessions will be stored. +jetty.session.gracePeriod.seconds:: +Amount of time, in seconds, to wait for other nodes to be checked to verify an expired session is in fact expired throughout the cluster before closing it. jetty.session.hazelcast.configurationLocation:: Path to an an Hazelcast xml configuration file +jetty.session.savePeriod.seconds=0:: +By default whenever the last concurrent request leaves a session, that session is always persisted via the `SessionDataStore`, even if the only thing that changed on the session is its updated last access time. +A non-zero value means that the `SessionDataStore` will skip persisting the session if only the access time changed, and it has been less than `savePeriod` seconds since the last time the session was written. ++ +____ +[NOTE] +Configuring `savePeriod` is useful if your persistence technology is very slow/costly for writes. +In a clustered environment, there is a risk of the last access time of the session being out-of-date in the shared store for up to `savePeriod` seconds. +This allows the possibility that a node may prematurely expire the session, even though it is in use by another node. +Thorough consideration of the `maxIdleTime` of the session when setting the `savePeriod` is imperative - there is no point in setting a `savePeriod` that is larger than the `maxIdleTime`. +____ diff --git a/jetty-documentation/src/main/asciidoc/configuring/connectors/configuring-ssl.adoc b/jetty-documentation/src/main/asciidoc/configuring/connectors/configuring-ssl.adoc index bace232bf7d..fd749015d61 100644 --- a/jetty-documentation/src/main/asciidoc/configuring/connectors/configuring-ssl.adoc +++ b/jetty-documentation/src/main/asciidoc/configuring/connectors/configuring-ssl.adoc @@ -637,10 +637,9 @@ KeyIdentifier [ ******************************************* ---- -Additionally, you can split `$JETTY/etc/keystore` into two files. -One being `$JETTY/etc/keystore` which only contains the server’s private key and certificate, while the other would be `$JETTY/etc/truststore` which contains intermediary CA and root CA. - -An example of this would look like the following: +In addition, you can split `$JETTY/etc/keystore` as two files. +One is `$JETTY/etc/keystore` which only contains the server’s private key and certificate, +the other is `$JETTY/etc/truststore` which contains intermediary CA and root CA. [literal] .The structure of `$JETTY/etc/keystore` @@ -688,7 +687,7 @@ setKeyStorePath:: The configured keystore to use for all SSL/TLS in configured Jetty Connector (or Client). ____ [NOTE] -As the keystore is vital security information, it recommended the file is located in a directory with *very* restricted access. +As a keystore is vital security information, it can be desirable to locate the file in a directory with *very* restricted access. ____ setKeyStorePassword:: @@ -713,7 +712,7 @@ ____ ____ [CAUTION] -The keystore and truststore passwords may also be set using the system properties: `org.eclipse.jetty.ssl.keypassword` and `org.eclipse.jetty.ssl.password`. +The keystore and truststore passwords may also be set using the system properties: `org.eclipse.jetty.ssl.keypassword` `org.eclipse.jetty.ssl.password`. This is _not_ a recommended usage. ____ @@ -802,8 +801,7 @@ jetty.sslContext.needClientAuth=true [[configuring-sslcontextfactory-cipherSuites]] ==== Disabling/Enabling Specific Cipher Suites -To avoid specific attacks it is often necessary to configure a specific set of cipher suites to include or exclude. -This can either be done via link:{JDURL}/org/eclipse/jetty/util/ssl/SslContextFactory.html#setIncludeCipherSuites(java.lang.String...)[SslContext.setIncludeCipherSuites(java.lang.String...)] or vialink:{JDURL}/org/eclipse/jetty/util/ssl/SslContextFactory.html#setExcludeCipherSuites(java.lang.String...)[SslContext.setExcludeCipherSuites(java.lang.String...)]. +As an example, to avoid the BEAST attack it is necessary to configure a specific set of cipher suites. This can either be done via link:{JDURL}/org/eclipse/jetty/util/ssl/SslContextFactory.html#setIncludeCipherSuites(java.lang.String...)[SslContext.setIncludeCipherSuites(java.lang.String...)] or vialink:{JDURL}/org/eclipse/jetty/util/ssl/SslContextFactory.html#setExcludeCipherSuites(java.lang.String...)[SslContext.setExcludeCipherSuites(java.lang.String...)]. ____ [NOTE] diff --git a/jetty-documentation/src/main/asciidoc/index-docinfo.xml b/jetty-documentation/src/main/asciidoc/index-docinfo.xml index 8fcb9cf2f2b..8a6f6c2bf36 100644 --- a/jetty-documentation/src/main/asciidoc/index-docinfo.xml +++ b/jetty-documentation/src/main/asciidoc/index-docinfo.xml @@ -1,96 +1,96 @@ 1995-2017 Mort Bay Consulting Pty. Ltd. - - - - {revnumber} - - - - + + + + {revnumber} + + + + This documentation is produced and contributed to under the Eclipse Public License v1.0. - - - - - jetty - servlet - servlet-api - cometd - http - websocket - eclipse - maven - java - server - software - - - - - Jan - Bartel - - - Jetty - Project Lead - - - - - Thomas - Becker - - - Jetty - Committer - - - - - Simone - Bordet - - - Jetty - Committer - - - - - Joakim - Erdfelt - - - Jetty - Committer - - - - - Jesse - McConnell - - - Jetty - Committer - - - - - Greg - Wilkins - - - Jetty - Project Lead - - - - - Shirley - Boulay - - - + + + + + jetty + servlet + servlet-api + cometd + http + websocket + eclipse + maven + java + server + software + + + + + Jan + Bartel + + + Jetty + Project Lead + + + + + Thomas + Becker + + + Jetty + Committer + + + + + Simone + Bordet + + + Jetty + Committer + + + + + Joakim + Erdfelt + + + Jetty + Committer + + + + + Jesse + McConnell + + + Jetty + Committer + + + + + Greg + Wilkins + + + Jetty + Project Lead + + + + + Shirley + Boulay + + + diff --git a/jetty-fcgi/fcgi-client/pom.xml b/jetty-fcgi/fcgi-client/pom.xml index 979277db374..7bce605bb2f 100644 --- a/jetty-fcgi/fcgi-client/pom.xml +++ b/jetty-fcgi/fcgi-client/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty.fcgi fcgi-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 diff --git a/jetty-fcgi/fcgi-server/pom.xml b/jetty-fcgi/fcgi-server/pom.xml index 3f185cbae1c..62b9bc50373 100644 --- a/jetty-fcgi/fcgi-server/pom.xml +++ b/jetty-fcgi/fcgi-server/pom.xml @@ -1,73 +1,67 @@ - - org.eclipse.jetty.fcgi - fcgi-parent - 9.2.23-SNAPSHOT - + + org.eclipse.jetty.fcgi + fcgi-parent + 9.4.7-SNAPSHOT + - 4.0.0 - fcgi-server - Jetty :: FastCGI :: Server + 4.0.0 + fcgi-server + Jetty :: FastCGI :: Server - - ${project.groupId}.server - + + ${project.groupId}.server + - - - - maven-assembly-plugin - - - package - - single - - - - config - - - - - - - - - - - javax.servlet - javax.servlet-api - - - org.eclipse.jetty.fcgi - fcgi-client - ${project.version} - - - org.eclipse.jetty - jetty-proxy - ${project.version} - - - org.eclipse.jetty - jetty-server - ${project.version} - - - - org.eclipse.jetty - jetty-servlet - ${project.version} - test - - - org.eclipse.jetty.spdy - spdy-http-server - ${project.version} - test - - + + + + + + + javax.servlet + javax.servlet-api + + + org.eclipse.jetty.fcgi + fcgi-client + ${project.version} + + + org.eclipse.jetty + jetty-proxy + ${project.version} + + + org.eclipse.jetty + jetty-server + ${project.version} + + + org.eclipse.jetty + jetty-servlet + ${project.version} + test + + + org.eclipse.jetty.http2 + http2-server + ${project.version} + test + + + org.eclipse.jetty + jetty-alpn-server + ${project.version} + test + + + org.eclipse.jetty + jetty-annotations + ${project.version} + test + + diff --git a/jetty-fcgi/pom.xml b/jetty-fcgi/pom.xml index 4823bb33b55..590026f17e6 100644 --- a/jetty-fcgi/pom.xml +++ b/jetty-fcgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 diff --git a/jetty-hazelcast/pom.xml b/jetty-hazelcast/pom.xml index 163f40e24bd..3732b0a9b6e 100644 --- a/jetty-hazelcast/pom.xml +++ b/jetty-hazelcast/pom.xml @@ -1,19 +1,68 @@ + org.eclipse.jetty jetty-project - 9.3.21-SNAPSHOT + 9.4.7-SNAPSHOT + 4.0.0 jetty-hazelcast - Jetty :: Hazelcast Session Managers - http://www.eclipse.org/jetty + Jetty :: Hazelcast Session Manager + - ${project.groupId}.hazelcast - 1.0.2 3.8.2 + ${project.groupId}.hazelcast + + + + com.hazelcast + hazelcast + ${hazelcast.version} + test-jar + + + com.hazelcast + hazelcast-client + ${hazelcast.version} + + + com.hazelcast + hazelcast + ${hazelcast.version} + + + org.eclipse.jetty + jetty-server + ${project.version} + + + org.eclipse.jetty + jetty-webapp + ${project.version} + test + + + org.eclipse.jetty.websocket + websocket-servlet + ${project.version} + test + + + org.eclipse.jetty.websocket + websocket-server + ${project.version} + test + + + org.eclipse.jetty.toolchain + jetty-test-helper + test + + + @@ -33,32 +82,7 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - - com.hazelcast - hazelcast-jetty9-sessionmanager - ${hazelcast.sessionManager.version} - - - com.hazelcast - hazelcast-all - ${hazelcast.version} - - - org.eclipse.jetty - jetty-server - ${project.version} - - + diff --git a/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/default.xml b/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/default.xml index 3c666c3d3fd..680e6f07d3f 100644 --- a/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/default.xml +++ b/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/default.xml @@ -3,17 +3,19 @@ - - - - - - - - - - false - - - \ No newline at end of file + + + + + + + + + + + + + + + diff --git a/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/remote.xml b/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/remote.xml index 47aa62e1b69..ca32fcff21d 100644 --- a/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/remote.xml +++ b/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/remote.xml @@ -4,16 +4,18 @@ - + + - - - - - - - true - - - - \ No newline at end of file + + + + + + + + + + + + diff --git a/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-embedded.mod b/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-embedded.mod new file mode 100644 index 00000000000..daa55012162 --- /dev/null +++ b/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-embedded.mod @@ -0,0 +1,34 @@ +[description] +Enables session data store in an embedded Hazelcast Map + +[tags] +session + +[provides] +session-store + +[depend] +sessions + +[files] +maven://com.hazelcast/hazelcast/3.8.2|lib/hazelcast/hazelcast-3.8.2.jar + +[xml] +etc/sessions/hazelcast/default.xml + +[lib] +lib/jetty-hazelcast-${jetty.version}.jar +lib/hazelcast/*.jar + +[license] +Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license. +https://hazelcast.org/ +http://www.apache.org/licenses/LICENSE-2.0.html + + +[ini-template] +jetty.session.hazelcast.mapName=jetty-distributed-session-map +jetty.session.hazelcast.hazelcastInstanceName=JETTY_DISTRIBUTED_SESSION_INSTANCE +#jetty.session.hazelcast.configurationLocation= +jetty.session.gracePeriod.seconds=3600 +jetty.session.savePeriod.seconds=0 \ No newline at end of file diff --git a/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod b/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod new file mode 100644 index 00000000000..55baa0e3d68 --- /dev/null +++ b/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod @@ -0,0 +1,36 @@ +[description] +Enables session data store in a remote Hazelcast Map + +[tags] +session + +[provides] +session-store + +[depend] +sessions + +[files] +maven://com.hazelcast/hazelcast/3.8.2|lib/hazelcast/hazelcast-3.8.2.jar +maven://com.hazelcast/hazelcast-client/3.8.2|lib/hazelcast/hazelcast-client-3.8.2.jar + +[xml] +etc/sessions/hazelcast/remote.xml + +[lib] +lib/jetty-hazelcast-${jetty.version}.jar +lib/hazelcast/*.jar + +[license] +Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license. + https://hazelcast.org/ +http://www.apache.org/licenses/LICENSE-2.0.html + + +[ini-template] +jetty.session.hazelcast.mapName=jetty-distributed-session-map +jetty.session.hazelcast.hazelcastInstanceName=JETTY_DISTRIBUTED_SESSION_INSTANCE +jetty.session.hazelcast.onlyClient=true +#jetty.session.hazelcast.configurationLocation= +jetty.session.gracePeriod.seconds=3600 +jetty.session.savePeriod.seconds=0 \ No newline at end of file diff --git a/jetty-home/pom.xml b/jetty-home/pom.xml index e9a654f98f2..2379629a38f 100644 --- a/jetty-home/pom.xml +++ b/jetty-home/pom.xml @@ -483,23 +483,11 @@ jetty-spring ${project.version} - org.eclipse.jetty.cdi cdi-servlet ${project.version} - - org.eclipse.jetty.cdi - cdi-websocket - ${project.version} - org.eclipse.jetty jetty-jaas diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index e283cd587be..9b7a447e6fa 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-http-spi @@ -32,35 +32,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.codehaus.mojo findbugs-maven-plugin @@ -68,6 +39,19 @@ org.eclipse.jetty.http.spi.* + + org.apache.felix + maven-bundle-plugin + true + + + Jetty Http SPI + osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)" + osgi.serviceloader; osgi.serviceloader=com.sun.net.httpserver.spi.HttpServerProvider + <_nouses>true + + + org.jacoco jacoco-maven-plugin diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/HttpSpiContextHandler.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/HttpSpiContextHandler.java index 1c3d5c3ff15..878e3b752ca 100644 --- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/HttpSpiContextHandler.java +++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/HttpSpiContextHandler.java @@ -1,162 +1,162 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.http.spi; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.handler.ContextHandler; -import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; - -import com.sun.net.httpserver.Authenticator; -import com.sun.net.httpserver.Authenticator.Result; -import com.sun.net.httpserver.HttpContext; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpPrincipal; - -/** - * Jetty handler that bridges requests to {@link HttpHandler}. - */ -public class HttpSpiContextHandler extends ContextHandler -{ - public static final Logger LOG = Log.getLogger(HttpSpiContextHandler.class); - - private HttpContext _httpContext; - - private HttpHandler _httpHandler; - - public HttpSpiContextHandler(HttpContext httpContext, HttpHandler httpHandler) - { - this._httpContext = httpContext; - this._httpHandler = httpHandler; - } - - @Override - public void doScope(String target, Request baseRequest, HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException - { - if (!target.startsWith(getContextPath())) - { - return; - } - - HttpExchange jettyHttpExchange; - if (baseRequest.isSecure()) - { - jettyHttpExchange = new JettyHttpsExchange(_httpContext,req,resp); - } - else - { - jettyHttpExchange = new JettyHttpExchange(_httpContext,req,resp); - } - - // TODO: add filters processing - - try - { - Authenticator auth = _httpContext.getAuthenticator(); - if (auth != null) - { - handleAuthentication(resp,jettyHttpExchange,auth); - } - else - { - _httpHandler.handle(jettyHttpExchange); - } - } - catch (Exception ex) - { - LOG.debug(ex); - PrintWriter writer = new PrintWriter(jettyHttpExchange.getResponseBody()); - - resp.setStatus(500); - writer.println("

HTTP ERROR: 500

"); - writer.println("
INTERNAL_SERVER_ERROR
"); - writer.println("

RequestURI=" + StringUtil.sanitizeXmlString(req.getRequestURI()) + "

"); - - if (LOG.isDebugEnabled()) - { - writer.println("
");
-                ex.printStackTrace(writer);
-                writer.println("
"); - } - - baseRequest.getHttpChannel().getHttpConfiguration().writePoweredBy(writer,"

","

"); - - writer.close(); - } - finally - { - baseRequest.setHandled(true); - } - - } - - private void handleAuthentication(HttpServletResponse resp, HttpExchange httpExchange, Authenticator auth) throws IOException - { - Result result = auth.authenticate(httpExchange); - if (result instanceof Authenticator.Failure) - { - int rc = ((Authenticator.Failure)result).getResponseCode(); - for (Map.Entry> header : httpExchange.getResponseHeaders().entrySet()) - { - for (String value : header.getValue()) - resp.addHeader(header.getKey(),value); - } - resp.sendError(rc); - } - else if (result instanceof Authenticator.Retry) - { - int rc = ((Authenticator.Retry)result).getResponseCode(); - for (Map.Entry> header : httpExchange.getResponseHeaders().entrySet()) - { - for (String value : header.getValue()) - resp.addHeader(header.getKey(),value); - } - resp.setStatus(rc); - resp.flushBuffer(); - } - else if (result instanceof Authenticator.Success) - { - HttpPrincipal principal = ((Authenticator.Success)result).getPrincipal(); - ((JettyExchange)httpExchange).setPrincipal(principal); - _httpHandler.handle(httpExchange); - } - } - - public HttpHandler getHttpHandler() - { - return _httpHandler; - } - - public void setHttpHandler(HttpHandler handler) - { - this._httpHandler = handler; - } - -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.http.spi; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.handler.ContextHandler; +import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; + +import com.sun.net.httpserver.Authenticator; +import com.sun.net.httpserver.Authenticator.Result; +import com.sun.net.httpserver.HttpContext; +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpPrincipal; + +/** + * Jetty handler that bridges requests to {@link HttpHandler}. + */ +public class HttpSpiContextHandler extends ContextHandler +{ + public static final Logger LOG = Log.getLogger(HttpSpiContextHandler.class); + + private HttpContext _httpContext; + + private HttpHandler _httpHandler; + + public HttpSpiContextHandler(HttpContext httpContext, HttpHandler httpHandler) + { + this._httpContext = httpContext; + this._httpHandler = httpHandler; + } + + @Override + public void doScope(String target, Request baseRequest, HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException + { + if (!target.startsWith(getContextPath())) + { + return; + } + + HttpExchange jettyHttpExchange; + if (baseRequest.isSecure()) + { + jettyHttpExchange = new JettyHttpsExchange(_httpContext,req,resp); + } + else + { + jettyHttpExchange = new JettyHttpExchange(_httpContext,req,resp); + } + + // TODO: add filters processing + + try + { + Authenticator auth = _httpContext.getAuthenticator(); + if (auth != null) + { + handleAuthentication(resp,jettyHttpExchange,auth); + } + else + { + _httpHandler.handle(jettyHttpExchange); + } + } + catch (Exception ex) + { + LOG.debug(ex); + PrintWriter writer = new PrintWriter(jettyHttpExchange.getResponseBody()); + + resp.setStatus(500); + writer.println("

HTTP ERROR: 500

"); + writer.println("
INTERNAL_SERVER_ERROR
"); + writer.println("

RequestURI=" + StringUtil.sanitizeXmlString(req.getRequestURI()) + "

"); + + if (LOG.isDebugEnabled()) + { + writer.println("
");
+                ex.printStackTrace(writer);
+                writer.println("
"); + } + + baseRequest.getHttpChannel().getHttpConfiguration().writePoweredBy(writer,"

","

"); + + writer.close(); + } + finally + { + baseRequest.setHandled(true); + } + + } + + private void handleAuthentication(HttpServletResponse resp, HttpExchange httpExchange, Authenticator auth) throws IOException + { + Result result = auth.authenticate(httpExchange); + if (result instanceof Authenticator.Failure) + { + int rc = ((Authenticator.Failure)result).getResponseCode(); + for (Map.Entry> header : httpExchange.getResponseHeaders().entrySet()) + { + for (String value : header.getValue()) + resp.addHeader(header.getKey(),value); + } + resp.sendError(rc); + } + else if (result instanceof Authenticator.Retry) + { + int rc = ((Authenticator.Retry)result).getResponseCode(); + for (Map.Entry> header : httpExchange.getResponseHeaders().entrySet()) + { + for (String value : header.getValue()) + resp.addHeader(header.getKey(),value); + } + resp.setStatus(rc); + resp.flushBuffer(); + } + else if (result instanceof Authenticator.Success) + { + HttpPrincipal principal = ((Authenticator.Success)result).getPrincipal(); + ((JettyExchange)httpExchange).setPrincipal(principal); + _httpHandler.handle(httpExchange); + } + } + + public HttpHandler getHttpHandler() + { + return _httpHandler; + } + + public void setHttpHandler(HttpHandler handler) + { + this._httpHandler = handler; + } + +} diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpContext.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpContext.java index 717c4d4b586..23ece00fba1 100644 --- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpContext.java +++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpContext.java @@ -1,111 +1,111 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.http.spi; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.sun.net.httpserver.Authenticator; -import com.sun.net.httpserver.Filter; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpServer; - -/** - * Jetty implementation of {@link com.sun.net.httpserver.HttpContext} - */ -public class JettyHttpContext extends com.sun.net.httpserver.HttpContext -{ - - private HttpSpiContextHandler _jettyContextHandler; - - private HttpServer _server; - - private Map _attributes = new HashMap(); - - private List _filters = new ArrayList(); - - private Authenticator _authenticator; - - - protected JettyHttpContext(HttpServer server, String path, - HttpHandler handler) - { - this._server = server; - _jettyContextHandler = new HttpSpiContextHandler(this, handler); - _jettyContextHandler.setContextPath(path); - } - - protected HttpSpiContextHandler getJettyContextHandler() - { - return _jettyContextHandler; - } - - @Override - public HttpHandler getHandler() - { - return _jettyContextHandler.getHttpHandler(); - } - - @Override - public void setHandler(HttpHandler h) - { - _jettyContextHandler.setHttpHandler(h); - } - - @Override - public String getPath() - { - return _jettyContextHandler.getContextPath(); - } - - @Override - public HttpServer getServer() - { - return _server; - } - - @Override - public Map getAttributes() - { - return _attributes; - } - - @Override - public List getFilters() - { - return _filters; - } - - @Override - public Authenticator setAuthenticator(Authenticator auth) - { - Authenticator previous = _authenticator; - _authenticator = auth; - return previous; - } - - @Override - public Authenticator getAuthenticator() - { - return _authenticator; - } - -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.http.spi; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.sun.net.httpserver.Authenticator; +import com.sun.net.httpserver.Filter; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; + +/** + * Jetty implementation of {@link com.sun.net.httpserver.HttpContext} + */ +public class JettyHttpContext extends com.sun.net.httpserver.HttpContext +{ + + private HttpSpiContextHandler _jettyContextHandler; + + private HttpServer _server; + + private Map _attributes = new HashMap(); + + private List _filters = new ArrayList(); + + private Authenticator _authenticator; + + + protected JettyHttpContext(HttpServer server, String path, + HttpHandler handler) + { + this._server = server; + _jettyContextHandler = new HttpSpiContextHandler(this, handler); + _jettyContextHandler.setContextPath(path); + } + + protected HttpSpiContextHandler getJettyContextHandler() + { + return _jettyContextHandler; + } + + @Override + public HttpHandler getHandler() + { + return _jettyContextHandler.getHttpHandler(); + } + + @Override + public void setHandler(HttpHandler h) + { + _jettyContextHandler.setHttpHandler(h); + } + + @Override + public String getPath() + { + return _jettyContextHandler.getContextPath(); + } + + @Override + public HttpServer getServer() + { + return _server; + } + + @Override + public Map getAttributes() + { + return _attributes; + } + + @Override + public List getFilters() + { + return _filters; + } + + @Override + public Authenticator setAuthenticator(Authenticator auth) + { + Authenticator previous = _authenticator; + _authenticator = auth; + return previous; + } + + @Override + public Authenticator getAuthenticator() + { + return _authenticator; + } + +} diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpExchangeDelegate.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpExchangeDelegate.java index 732f97f94a7..dc9f9cfc122 100644 --- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpExchangeDelegate.java +++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpExchangeDelegate.java @@ -1,233 +1,233 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.http.spi; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Enumeration; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.sun.net.httpserver.Headers; -import com.sun.net.httpserver.HttpContext; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpPrincipal; - -/** - * Jetty implementation of {@link com.sun.net.httpserver.HttpExchange} - */ -public class JettyHttpExchangeDelegate extends HttpExchange -{ - - private HttpContext _httpContext; - - private HttpServletRequest _req; - - private HttpServletResponse _resp; - - private Headers _responseHeaders = new Headers(); - - private int _responseCode = 0; - - private InputStream _is; - - private OutputStream _os; - - private HttpPrincipal _httpPrincipal; - - JettyHttpExchangeDelegate(HttpContext jaxWsContext, HttpServletRequest req, HttpServletResponse resp) - { - this._httpContext = jaxWsContext; - this._req = req; - this._resp = resp; - try - { - this._is = req.getInputStream(); - this._os = resp.getOutputStream(); - } - catch (IOException ex) - { - throw new RuntimeException(ex); - } - } - - @Override - public Headers getRequestHeaders() - { - Headers headers = new Headers(); - Enumeration en = _req.getHeaderNames(); - while (en.hasMoreElements()) - { - String name = (String)en.nextElement(); - Enumeration en2 = _req.getHeaders(name); - while (en2.hasMoreElements()) - { - String value = (String)en2.nextElement(); - headers.add(name,value); - } - } - return headers; - } - - @Override - public Headers getResponseHeaders() - { - return _responseHeaders; - } - - @Override - public URI getRequestURI() - { - try - { - String uriAsString = _req.getRequestURI(); - if (_req.getQueryString() != null) - { - uriAsString += "?" + _req.getQueryString(); - } - - return new URI(uriAsString); - } - catch (URISyntaxException ex) - { - throw new RuntimeException(ex); - } - } - - @Override - public String getRequestMethod() - { - return _req.getMethod(); - } - - @Override - public HttpContext getHttpContext() - { - return _httpContext; - } - - @Override - public void close() - { - try - { - _resp.getOutputStream().close(); - } - catch (IOException ex) - { - throw new RuntimeException(ex); - } - } - - @Override - public InputStream getRequestBody() - { - return _is; - } - - @Override - public OutputStream getResponseBody() - { - return _os; - } - - @Override - public void sendResponseHeaders(int rCode, long responseLength) throws IOException - { - this._responseCode = rCode; - - for (Map.Entry> stringListEntry : _responseHeaders.entrySet()) - { - String name = stringListEntry.getKey(); - List values = stringListEntry.getValue(); - - for (String value : values) - { - _resp.setHeader(name,value); - } - } - if (responseLength > 0) - { - _resp.setHeader("content-length","" + responseLength); - } - _resp.setStatus(rCode); - } - - @Override - public InetSocketAddress getRemoteAddress() - { - return new InetSocketAddress(_req.getRemoteAddr(),_req.getRemotePort()); - } - - @Override - public int getResponseCode() - { - return _responseCode; - } - - @Override - public InetSocketAddress getLocalAddress() - { - return new InetSocketAddress(_req.getLocalAddr(),_req.getLocalPort()); - } - - @Override - public String getProtocol() - { - return _req.getProtocol(); - } - - @Override - public Object getAttribute(String name) - { - return _req.getAttribute(name); - } - - @Override - public void setAttribute(String name, Object value) - { - _req.setAttribute(name,value); - } - - @Override - public void setStreams(InputStream i, OutputStream o) - { - _is = i; - _os = o; - } - - @Override - public HttpPrincipal getPrincipal() - { - return _httpPrincipal; - } - - public void setPrincipal(HttpPrincipal principal) - { - this._httpPrincipal = principal; - } - -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.http.spi; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetSocketAddress; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Enumeration; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.sun.net.httpserver.Headers; +import com.sun.net.httpserver.HttpContext; +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpPrincipal; + +/** + * Jetty implementation of {@link com.sun.net.httpserver.HttpExchange} + */ +public class JettyHttpExchangeDelegate extends HttpExchange +{ + + private HttpContext _httpContext; + + private HttpServletRequest _req; + + private HttpServletResponse _resp; + + private Headers _responseHeaders = new Headers(); + + private int _responseCode = 0; + + private InputStream _is; + + private OutputStream _os; + + private HttpPrincipal _httpPrincipal; + + JettyHttpExchangeDelegate(HttpContext jaxWsContext, HttpServletRequest req, HttpServletResponse resp) + { + this._httpContext = jaxWsContext; + this._req = req; + this._resp = resp; + try + { + this._is = req.getInputStream(); + this._os = resp.getOutputStream(); + } + catch (IOException ex) + { + throw new RuntimeException(ex); + } + } + + @Override + public Headers getRequestHeaders() + { + Headers headers = new Headers(); + Enumeration en = _req.getHeaderNames(); + while (en.hasMoreElements()) + { + String name = (String)en.nextElement(); + Enumeration en2 = _req.getHeaders(name); + while (en2.hasMoreElements()) + { + String value = (String)en2.nextElement(); + headers.add(name,value); + } + } + return headers; + } + + @Override + public Headers getResponseHeaders() + { + return _responseHeaders; + } + + @Override + public URI getRequestURI() + { + try + { + String uriAsString = _req.getRequestURI(); + if (_req.getQueryString() != null) + { + uriAsString += "?" + _req.getQueryString(); + } + + return new URI(uriAsString); + } + catch (URISyntaxException ex) + { + throw new RuntimeException(ex); + } + } + + @Override + public String getRequestMethod() + { + return _req.getMethod(); + } + + @Override + public HttpContext getHttpContext() + { + return _httpContext; + } + + @Override + public void close() + { + try + { + _resp.getOutputStream().close(); + } + catch (IOException ex) + { + throw new RuntimeException(ex); + } + } + + @Override + public InputStream getRequestBody() + { + return _is; + } + + @Override + public OutputStream getResponseBody() + { + return _os; + } + + @Override + public void sendResponseHeaders(int rCode, long responseLength) throws IOException + { + this._responseCode = rCode; + + for (Map.Entry> stringListEntry : _responseHeaders.entrySet()) + { + String name = stringListEntry.getKey(); + List values = stringListEntry.getValue(); + + for (String value : values) + { + _resp.setHeader(name,value); + } + } + if (responseLength > 0) + { + _resp.setHeader("content-length","" + responseLength); + } + _resp.setStatus(rCode); + } + + @Override + public InetSocketAddress getRemoteAddress() + { + return new InetSocketAddress(_req.getRemoteAddr(),_req.getRemotePort()); + } + + @Override + public int getResponseCode() + { + return _responseCode; + } + + @Override + public InetSocketAddress getLocalAddress() + { + return new InetSocketAddress(_req.getLocalAddr(),_req.getLocalPort()); + } + + @Override + public String getProtocol() + { + return _req.getProtocol(); + } + + @Override + public Object getAttribute(String name) + { + return _req.getAttribute(name); + } + + @Override + public void setAttribute(String name, Object value) + { + _req.setAttribute(name,value); + } + + @Override + public void setStreams(InputStream i, OutputStream o) + { + _is = i; + _os = o; + } + + @Override + public HttpPrincipal getPrincipal() + { + return _httpPrincipal; + } + + public void setPrincipal(HttpPrincipal principal) + { + this._httpPrincipal = principal; + } + +} diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java index 2acf634d45d..60f3032600f 100644 --- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java +++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/JettyHttpServerProvider.java @@ -1,79 +1,79 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.http.spi; - -import java.io.IOException; -import java.net.InetSocketAddress; - -import org.eclipse.jetty.server.Handler; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.handler.ContextHandlerCollection; -import org.eclipse.jetty.server.handler.DefaultHandler; -import org.eclipse.jetty.server.handler.HandlerCollection; -import org.eclipse.jetty.util.thread.QueuedThreadPool; -import org.eclipse.jetty.util.thread.ThreadPool; - -import com.sun.net.httpserver.HttpServer; -import com.sun.net.httpserver.HttpsServer; -import com.sun.net.httpserver.spi.HttpServerProvider; - -/** - * Jetty implementation of Java HTTP Server SPI - */ -public class JettyHttpServerProvider extends HttpServerProvider -{ - - private static Server _server; - - public static void setServer(Server server) - { - _server = server; - } - - @Override - public HttpServer createHttpServer(InetSocketAddress addr, int backlog) - throws IOException - { - Server server = _server; - boolean shared = true; - - if (server == null) - { - ThreadPool threadPool = new DelegatingThreadPool(new QueuedThreadPool()); - server = new Server(threadPool); - - HandlerCollection handlerCollection = new HandlerCollection(); - handlerCollection.setHandlers(new Handler[] {new ContextHandlerCollection(), new DefaultHandler()}); - server.setHandler(handlerCollection); - - shared = false; - } - - JettyHttpServer jettyHttpServer = new JettyHttpServer(server, shared); - jettyHttpServer.bind(addr, backlog); - return jettyHttpServer; - } - - @Override - public HttpsServer createHttpsServer(InetSocketAddress addr, int backlog) throws IOException - { - throw new UnsupportedOperationException(); - } - -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.http.spi; + +import java.io.IOException; +import java.net.InetSocketAddress; + +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.ContextHandlerCollection; +import org.eclipse.jetty.server.handler.DefaultHandler; +import org.eclipse.jetty.server.handler.HandlerCollection; +import org.eclipse.jetty.util.thread.QueuedThreadPool; +import org.eclipse.jetty.util.thread.ThreadPool; + +import com.sun.net.httpserver.HttpServer; +import com.sun.net.httpserver.HttpsServer; +import com.sun.net.httpserver.spi.HttpServerProvider; + +/** + * Jetty implementation of Java HTTP Server SPI + */ +public class JettyHttpServerProvider extends HttpServerProvider +{ + + private static Server _server; + + public static void setServer(Server server) + { + _server = server; + } + + @Override + public HttpServer createHttpServer(InetSocketAddress addr, int backlog) + throws IOException + { + Server server = _server; + boolean shared = true; + + if (server == null) + { + ThreadPool threadPool = new DelegatingThreadPool(new QueuedThreadPool()); + server = new Server(threadPool); + + HandlerCollection handlerCollection = new HandlerCollection(); + handlerCollection.setHandlers(new Handler[] {new ContextHandlerCollection(), new DefaultHandler()}); + server.setHandler(handlerCollection); + + shared = false; + } + + JettyHttpServer jettyHttpServer = new JettyHttpServer(server, shared); + jettyHttpServer.bind(addr, backlog); + return jettyHttpServer; + } + + @Override + public HttpsServer createHttpsServer(InetSocketAddress addr, int backlog) throws IOException + { + throw new UnsupportedOperationException(); + } + +} diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index efb7fc9b4d8..6f40141cfe6 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-http @@ -18,6 +18,11 @@ jetty-util ${project.version} + + org.eclipse.jetty + jetty-io + ${project.version} + org.eclipse.jetty.toolchain jetty-test-helper @@ -30,29 +35,20 @@ org.apache.felix maven-bundle-plugin true - - - - manifest - - javax.servlet.*;version="[2.6.0,3.2)",javax.net.*,* + osgi.serviceloader; filter:="(osgi.serviceloader=org.eclipse.jetty.http.HttpFieldPreEncoder)";resolution:=optional;cardinality:=multiple, osgi.extender; filter:="(osgi.extender=osgi.serviceloader.processor)";resolution:=optional, osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional + + osgi.serviceloader; osgi.serviceloader=org.eclipse.jetty.http.HttpFieldPreEncoder - -
org.apache.maven.plugins maven-jar-plugin - - artifact-jar - - jar - - test-jar @@ -60,11 +56,6 @@ - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - org.codehaus.mojo @@ -73,6 +64,7 @@ org.eclipse.jetty.http.* +
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/Syntax.java b/jetty-http/src/main/java/org/eclipse/jetty/http/Syntax.java index 3a001eb8f7d..ab9aaa1a20a 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/Syntax.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/Syntax.java @@ -1,142 +1,142 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.http; - -import java.util.Objects; - -/** - * Collection of Syntax validation methods. - *

- * Use in a similar way as you would {@link java.util.Objects#requireNonNull(Object)} - *

- */ -public final class Syntax -{ - - /** - * Per RFC2616: Section 2.2, a token follows these syntax rules - *
-     *  token          = 1*<any CHAR except CTLs or separators>
-     *  CHAR           = <any US-ASCII character (octets 0 - 127)>
-     *  CTL            = <any US-ASCII control character
-     *                   (octets 0 - 31) and DEL (127)>
-     *  separators     = "(" | ")" | "<" | ">" | "@"
-     *                 | "," | ";" | ":" | "\" | <">
-     *                 | "/" | "[" | "]" | "?" | "="
-     *                 | "{" | "}" | SP | HT
-     * 
- * - * @param value the value to test - * @param msg the message to be prefixed if an {@link IllegalArgumentException} is thrown. - * @throws IllegalArgumentException if the value is invalid per spec - */ - public static void requireValidRFC2616Token(String value, String msg) - { - Objects.requireNonNull(msg, "msg cannot be null"); - - if (value == null) - { - return; - } - - int valueLen = value.length(); - if (valueLen == 0) - { - return; - } - - for (int i = 0; i < valueLen; i++) - { - char c = value.charAt(i); - - // 0x00 - 0x1F are low order control characters - // 0x7F is the DEL control character - if ((c <= 0x1F) || (c == 0x7F)) - throw new IllegalArgumentException(msg + ": RFC2616 tokens may not contain control characters"); - if (c == '(' || c == ')' || c == '<' || c == '>' || c == '@' - || c == ',' || c == ';' || c == ':' || c == '\\' || c == '"' - || c == '/' || c == '[' || c == ']' || c == '?' || c == '=' - || c == '{' || c == '}' || c == ' ') - { - throw new IllegalArgumentException(msg + ": RFC2616 tokens may not contain separator character: [" + c + "]"); - } - if (c >= 0x80) - throw new IllegalArgumentException(msg + ": RFC2616 tokens characters restricted to US-ASCII: 0x" + Integer.toHexString(c)); - } - } - - /** - * Per RFC6265, Cookie.value follows these syntax rules - *
-     *  cookie-value      = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
-     *  cookie-octet      = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
-     *                      ; US-ASCII characters excluding CTLs,
-     *                      ; whitespace DQUOTE, comma, semicolon,
-     *                      ; and backslash
-     * 
- * - * @param value the value to test - * @throws IllegalArgumentException if the value is invalid per spec - */ - public static void requireValidRFC6265CookieValue(String value) - { - if (value == null) - { - return; - } - - int valueLen = value.length(); - if (valueLen == 0) - { - return; - } - - int i = 0; - if (value.charAt(0) == '"') - { - // Has starting DQUOTE - if (valueLen <= 1 || (value.charAt(valueLen - 1) != '"')) - { - throw new IllegalArgumentException("RFC6265 Cookie values must have balanced DQUOTES (if used)"); - } - - // adjust search range to exclude DQUOTES - i++; - valueLen--; - } - for (; i < valueLen; i++) - { - char c = value.charAt(i); - - // 0x00 - 0x1F are low order control characters - // 0x7F is the DEL control character - if ((c <= 0x1F) || (c == 0x7F)) - throw new IllegalArgumentException("RFC6265 Cookie values may not contain control characters"); - if ((c == ' ' /* 0x20 */) || - (c == '"' /* 0x2C */) || - (c == ';' /* 0x3B */) || - (c == '\\' /* 0x5C */)) - { - throw new IllegalArgumentException("RFC6265 Cookie values may not contain character: [" + c + "]"); - } - if (c >= 0x80) - throw new IllegalArgumentException("RFC6265 Cookie values characters restricted to US-ASCII: 0x" + Integer.toHexString(c)); - } - } -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.http; + +import java.util.Objects; + +/** + * Collection of Syntax validation methods. + *

+ * Use in a similar way as you would {@link java.util.Objects#requireNonNull(Object)} + *

+ */ +public final class Syntax +{ + + /** + * Per RFC2616: Section 2.2, a token follows these syntax rules + *
+     *  token          = 1*<any CHAR except CTLs or separators>
+     *  CHAR           = <any US-ASCII character (octets 0 - 127)>
+     *  CTL            = <any US-ASCII control character
+     *                   (octets 0 - 31) and DEL (127)>
+     *  separators     = "(" | ")" | "<" | ">" | "@"
+     *                 | "," | ";" | ":" | "\" | <">
+     *                 | "/" | "[" | "]" | "?" | "="
+     *                 | "{" | "}" | SP | HT
+     * 
+ * + * @param value the value to test + * @param msg the message to be prefixed if an {@link IllegalArgumentException} is thrown. + * @throws IllegalArgumentException if the value is invalid per spec + */ + public static void requireValidRFC2616Token(String value, String msg) + { + Objects.requireNonNull(msg, "msg cannot be null"); + + if (value == null) + { + return; + } + + int valueLen = value.length(); + if (valueLen == 0) + { + return; + } + + for (int i = 0; i < valueLen; i++) + { + char c = value.charAt(i); + + // 0x00 - 0x1F are low order control characters + // 0x7F is the DEL control character + if ((c <= 0x1F) || (c == 0x7F)) + throw new IllegalArgumentException(msg + ": RFC2616 tokens may not contain control characters"); + if (c == '(' || c == ')' || c == '<' || c == '>' || c == '@' + || c == ',' || c == ';' || c == ':' || c == '\\' || c == '"' + || c == '/' || c == '[' || c == ']' || c == '?' || c == '=' + || c == '{' || c == '}' || c == ' ') + { + throw new IllegalArgumentException(msg + ": RFC2616 tokens may not contain separator character: [" + c + "]"); + } + if (c >= 0x80) + throw new IllegalArgumentException(msg + ": RFC2616 tokens characters restricted to US-ASCII: 0x" + Integer.toHexString(c)); + } + } + + /** + * Per RFC6265, Cookie.value follows these syntax rules + *
+     *  cookie-value      = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
+     *  cookie-octet      = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
+     *                      ; US-ASCII characters excluding CTLs,
+     *                      ; whitespace DQUOTE, comma, semicolon,
+     *                      ; and backslash
+     * 
+ * + * @param value the value to test + * @throws IllegalArgumentException if the value is invalid per spec + */ + public static void requireValidRFC6265CookieValue(String value) + { + if (value == null) + { + return; + } + + int valueLen = value.length(); + if (valueLen == 0) + { + return; + } + + int i = 0; + if (value.charAt(0) == '"') + { + // Has starting DQUOTE + if (valueLen <= 1 || (value.charAt(valueLen - 1) != '"')) + { + throw new IllegalArgumentException("RFC6265 Cookie values must have balanced DQUOTES (if used)"); + } + + // adjust search range to exclude DQUOTES + i++; + valueLen--; + } + for (; i < valueLen; i++) + { + char c = value.charAt(i); + + // 0x00 - 0x1F are low order control characters + // 0x7F is the DEL control character + if ((c <= 0x1F) || (c == 0x7F)) + throw new IllegalArgumentException("RFC6265 Cookie values may not contain control characters"); + if ((c == ' ' /* 0x20 */) || + (c == '"' /* 0x2C */) || + (c == ';' /* 0x3B */) || + (c == '\\' /* 0x5C */)) + { + throw new IllegalArgumentException("RFC6265 Cookie values may not contain character: [" + c + "]"); + } + if (c >= 0x80) + throw new IllegalArgumentException("RFC6265 Cookie values characters restricted to US-ASCII: 0x" + Integer.toHexString(c)); + } + } +} diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/PathMappings.java b/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/PathMappings.java index cfa020f4ba7..3b085274203 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/PathMappings.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/PathMappings.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.TreeSet; import java.util.function.Predicate; @@ -64,7 +65,7 @@ public class PathMappings implements Iterable>, Dumpable out.append("PathMappings[size=").append(Integer.toString(_mappings.size())).append("]\n"); ContainerLifeCycle.dump(out, indent, _mappings); } - + @ManagedAttribute(value = "mappings", readonly = true) public List> getMappings() { @@ -206,6 +207,18 @@ public class PathMappings implements Iterable>, Dumpable return pathSpecString.charAt(0) == '^' ? new RegexPathSpec(pathSpecString):new ServletPathSpec(pathSpecString); } + public E get(PathSpec spec) + { + Optional optionalResource = _mappings.stream() + .filter(mappedResource -> mappedResource.getPathSpec().equals(spec)) + .map(mappedResource -> mappedResource.getResource()) + .findFirst(); + if(!optionalResource.isPresent()) + return null; + + return optionalResource.get(); + } + public boolean put(String pathSpecString, E resource) { return put(asPathSpec(pathSpecString),resource); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java index eece45c1060..d174c3efee4 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java @@ -1,134 +1,134 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.http; - -import static org.hamcrest.CoreMatchers.allOf; -import static org.hamcrest.CoreMatchers.containsString; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - -import org.junit.Test; - -public class SyntaxTest -{ - @Test - public void testRequireValidRFC2616Token_Good() - { - String tokens[] = { - "name", - "", - null, - "n.a.m.e", - "na-me", - "+name", - "na*me", - "na$me", - "#name" - }; - - for (String token : tokens) - { - Syntax.requireValidRFC2616Token(token, "Test Based"); - // No exception should occur here - } - } - - @Test - public void testRequireValidRFC2616Token_Bad() - { - String tokens[] = { - "\"name\"", - "name\t", - "na me", - "name\u0082", - "na\tme", - "na;me", - "{name}", - "[name]", - "\"" - }; - - for (String token : tokens) - { - try - { - Syntax.requireValidRFC2616Token(token, "Test Based"); - fail("RFC2616 Token [" + token + "] Should have thrown " + IllegalArgumentException.class.getName()); - } - catch (IllegalArgumentException e) - { - assertThat("Testing Bad RFC2616 Token [" + token + "]", e.getMessage(), - allOf(containsString("Test Based"), - containsString("RFC2616"))); - } - } - } - - @Test - public void testRequireValidRFC6265CookieValue_Good() - { - String values[] = { - "value", - "", - null, - "val=ue", - "val-ue", - "\"value\"", - "val/ue", - "v.a.l.u.e" - }; - - for (String value : values) - { - Syntax.requireValidRFC6265CookieValue(value); - // No exception should occur here - } - } - - @Test - public void testRequireValidRFC6265CookieValue_Bad() - { - String values[] = { - "va\tlue", - "\t", - "value\u0000", - "val\u0082ue", - "va lue", - "va;lue", - "\"value", - "value\"", - "val\\ue", - "val\"ue", - "\"" - }; - - for (String value : values) - { - try - { - Syntax.requireValidRFC6265CookieValue(value); - fail("RFC6265 Cookie Value [" + value + "] Should have thrown " + IllegalArgumentException.class.getName()); - } - catch (IllegalArgumentException e) - { - assertThat("Testing Bad RFC6265 Cookie Value [" + value + "]", e.getMessage(), containsString("RFC6265")); - } - } - } -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.http; + +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +import org.junit.Test; + +public class SyntaxTest +{ + @Test + public void testRequireValidRFC2616Token_Good() + { + String tokens[] = { + "name", + "", + null, + "n.a.m.e", + "na-me", + "+name", + "na*me", + "na$me", + "#name" + }; + + for (String token : tokens) + { + Syntax.requireValidRFC2616Token(token, "Test Based"); + // No exception should occur here + } + } + + @Test + public void testRequireValidRFC2616Token_Bad() + { + String tokens[] = { + "\"name\"", + "name\t", + "na me", + "name\u0082", + "na\tme", + "na;me", + "{name}", + "[name]", + "\"" + }; + + for (String token : tokens) + { + try + { + Syntax.requireValidRFC2616Token(token, "Test Based"); + fail("RFC2616 Token [" + token + "] Should have thrown " + IllegalArgumentException.class.getName()); + } + catch (IllegalArgumentException e) + { + assertThat("Testing Bad RFC2616 Token [" + token + "]", e.getMessage(), + allOf(containsString("Test Based"), + containsString("RFC2616"))); + } + } + } + + @Test + public void testRequireValidRFC6265CookieValue_Good() + { + String values[] = { + "value", + "", + null, + "val=ue", + "val-ue", + "\"value\"", + "val/ue", + "v.a.l.u.e" + }; + + for (String value : values) + { + Syntax.requireValidRFC6265CookieValue(value); + // No exception should occur here + } + } + + @Test + public void testRequireValidRFC6265CookieValue_Bad() + { + String values[] = { + "va\tlue", + "\t", + "value\u0000", + "val\u0082ue", + "va lue", + "va;lue", + "\"value", + "value\"", + "val\\ue", + "val\"ue", + "\"" + }; + + for (String value : values) + { + try + { + Syntax.requireValidRFC6265CookieValue(value); + fail("RFC6265 Cookie Value [" + value + "] Should have thrown " + IllegalArgumentException.class.getName()); + } + catch (IllegalArgumentException e) + { + assertThat("Testing Bad RFC6265 Cookie Value [" + value + "]", e.getMessage(), containsString("RFC6265")); + } + } + } +} diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java index 1d674882c4a..e3092db044d 100644 --- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java +++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HTTP2ServerConnection.java @@ -18,6 +18,7 @@ package org.eclipse.jetty.http2.server; +import java.io.Closeable; import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayDeque; diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 6a859cbf87e..d3dc774481b 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-io @@ -22,43 +22,9 @@ jetty-test-helper test - - org.mockito - mockito-core - test - - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.codehaus.mojo findbugs-maven-plugin diff --git a/jetty-jaas/pom.xml b/jetty-jaas/pom.xml index 0b210336b89..641a05935df 100644 --- a/jetty-jaas/pom.xml +++ b/jetty-jaas/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-jaas @@ -13,52 +13,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - <_versionpolicy> - javax.sql.*,javax.security.*,javax.naming.*, - javax.servlet.*;version="[2.6.0,3.2)", - * - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index 706d8759e2e..870a97c6a2a 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-jaspi @@ -10,57 +10,10 @@ Jetty security infrastructure http://www.eclipse.org/jetty - ${project.groupId}.jaspi + ${project.groupId}.security.jaspi - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.servlet.*;version="[2.6.0,3.2)",* - org.eclipse.jetty.security.jaspi.*;version="${parsedVersion.osgiVersion}" - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.codehaus.mojo findbugs-maven-plugin @@ -70,6 +23,24 @@ + + + jdk9 + + [1.9,) + + + + + maven-surefire-plugin + + @{argLine} --add-modules java.se.ee + + + + + + org.eclipse.jetty @@ -85,7 +56,6 @@ org.eclipse.jetty.orbit javax.security.auth.message - org.apache.geronimo.components geronimo-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index 7eb977a442d..18109574118 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-jmx @@ -14,52 +14,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.management.*,* - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - org.codehaus.mojo findbugs-maven-plugin @@ -80,6 +34,13 @@ jetty-util ${project.version} + + + com.openpojo + openpojo + 0.8.1 + test + diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 2b650f9af20..baf973f1c79 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-jndi diff --git a/jetty-jspc-maven-plugin/pom.xml b/jetty-jspc-maven-plugin/pom.xml index 06347d05d98..c10ff62f89d 100644 --- a/jetty-jspc-maven-plugin/pom.xml +++ b/jetty-jspc-maven-plugin/pom.xml @@ -2,31 +2,33 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-jspc-maven-plugin maven-plugin Jetty :: Jetty JSPC Maven Plugin + ${project.groupId}.jspc.plugin + org.apache.maven.plugins maven-surefire-plugin true + org.apache.maven.plugins maven-plugin-plugin - 2.9 exec-plugin-doc generate-sources - xdoc + descriptor helpmojo @@ -90,21 +92,20 @@ 1.8.4 - org.eclipse.jetty - apache-jstl - ${project.version} - - + org.eclipse.jetty + apache-jstl + ${project.version} + + - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.1 - - false - - + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + false + + project-team @@ -116,7 +117,7 @@ - - + + diff --git a/jetty-maven-plugin/pom.xml b/jetty-maven-plugin/pom.xml index 9449376b43d..d79f1c00fd1 100644 --- a/jetty-maven-plugin/pom.xml +++ b/jetty-maven-plugin/pom.xml @@ -2,12 +2,13 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-maven-plugin maven-plugin Jetty :: Jetty Maven Plugin + Jetty maven plugins 3.0.3 3.4 @@ -27,13 +28,11 @@ org.apache.maven.plugins maven-plugin-plugin - ${pluginToolsVersion} exec-plugin-doc generate-sources - xdoc helpmojo @@ -165,15 +164,14 @@ - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.1 - - false - - + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + false + + project-team @@ -185,8 +183,8 @@ - - + + diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDeployWar.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDeployWar.java index 8a20299896e..d713cb878b2 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDeployWar.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDeployWar.java @@ -1,78 +1,78 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.maven.plugin; - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; - -/** - *

- * This goal is used to run Jetty with a pre-assembled war. - *

- *

- * It accepts exactly the same options as the run-war goal. - * However, it doesn't assume that the current artifact is a - * webapp and doesn't try to assemble it into a war before its execution. - * So using it makes sense only when used in conjunction with the - * war configuration parameter pointing to a pre-built WAR. - *

- *

- * This goal is useful e.g. for launching a web app in Jetty as a target for unit-tested - * HTTP client components. - *

- * - * @goal deploy-war - * @requiresDependencyResolution runtime - * @execute phase="validate" - * @description Deploy a pre-assembled war - * - */ -public class JettyDeployWar extends JettyRunWarMojo -{ - - - /** - * If true, the plugin should continue and not block. Otherwise the - * plugin will block further execution and you will need to use - * cntrl-c to stop it. - * - * - * @parameter default-value="true" - */ - protected boolean daemon = true; - - - @Override - public void execute() throws MojoExecutionException, MojoFailureException - { - nonBlocking = daemon; - super.execute(); - } - - - - @Override - public void finishConfigurationBeforeStart() throws Exception - { - super.finishConfigurationBeforeStart(); - //only stop the server at shutdown if we are blocking - server.setStopAtShutdown(!nonBlocking ); - } - -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.maven.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; + +/** + *

+ * This goal is used to run Jetty with a pre-assembled war. + *

+ *

+ * It accepts exactly the same options as the run-war goal. + * However, it doesn't assume that the current artifact is a + * webapp and doesn't try to assemble it into a war before its execution. + * So using it makes sense only when used in conjunction with the + * war configuration parameter pointing to a pre-built WAR. + *

+ *

+ * This goal is useful e.g. for launching a web app in Jetty as a target for unit-tested + * HTTP client components. + *

+ * + * @goal deploy-war + * @requiresDependencyResolution runtime + * @execute phase="validate" + * @description Deploy a pre-assembled war + * + */ +public class JettyDeployWar extends JettyRunWarMojo +{ + + + /** + * If true, the plugin should continue and not block. Otherwise the + * plugin will block further execution and you will need to use + * cntrl-c to stop it. + * + * + * @parameter default-value="true" + */ + protected boolean daemon = true; + + + @Override + public void execute() throws MojoExecutionException, MojoFailureException + { + nonBlocking = daemon; + super.execute(); + } + + + + @Override + public void finishConfigurationBeforeStart() throws Exception + { + super.finishConfigurationBeforeStart(); + //only stop the server at shutdown if we are blocking + server.setStopAtShutdown(!nonBlocking ); + } + +} diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index baaa930e174..3374ec2e9e0 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -1,25 +1,9 @@ - + org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.0-SNAPSHOT 4.0.0 jetty-monitor @@ -31,52 +15,6 @@
- - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.management.*,* - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index c45726f7dba..1adc155c95a 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-nosql @@ -14,57 +14,6 @@ install - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - - - org.apache.felix - maven-bundle-plugin - - - javax.servlet.*;version="[2.6.0,3.2)",org.eclipse.jetty.server.session.jmx;version="9.1";resolution:=optional,,org.eclipse.jetty.*;version="9.1",* - - - true - - - - manifest - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - @@ -87,7 +36,7 @@ org.mongodb mongo-java-driver - 2.6.1 + 2.13.2 jar compile diff --git a/jetty-osgi/jetty-osgi-alpn/pom.xml b/jetty-osgi/jetty-osgi-alpn/pom.xml index 1b453522d67..0287a75982b 100644 --- a/jetty-osgi/jetty-osgi-alpn/pom.xml +++ b/jetty-osgi/jetty-osgi-alpn/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-osgi-alpn @@ -16,7 +16,6 @@ org.codehaus.mojo build-helper-maven-plugin - 1.7 parse-version @@ -25,26 +24,32 @@ ${alpn.api.version} + alpn - org.apache.maven.plugins - maven-jar-plugin + org.apache.felix + maven-bundle-plugin - - - 2 + ${bundle-symbolic-name};singleton:=true Jetty OSGi ALPN Fragment - ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion} - org.eclipse.jetty.alpn;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" + !javax.*;!org.eclipse.jetty.* + org.eclipse.jetty.alpn;version="${alpn.majorVersion}.${alpn.minorVersion}.${alpn.incrementalVersion}" system.bundle;extension:=framework - - + + + + org.eclipse.jetty.alpn + alpn-api + ${alpn.api.version} + provided + + diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index a91841f36ad..aaddee1b547 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-osgi-boot-jsp @@ -42,67 +42,14 @@ apache-jsp ${project.version} - - org.eclipse.jetty.orbit - javax.servlet.jsp.jstl - - - org.glassfish.web - javax.servlet.jsp.jstl - - - org.mortbay.jasper - apache-el - 8.0.9.M3 - - - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - test-jar - - test-jar - - - - - - target/classes/META-INF/MANIFEST.MF - - - org.apache.felix maven-bundle-plugin true - - - bundle-manifest - process-classes - - manifest - - - Jetty-OSGi-Jasper Integration @@ -110,6 +57,7 @@ org.eclipse.jetty.osgi.boot !org.eclipse.jetty.osgi.boot.* org.eclipse.jdt.*;resolution:=optional, + org.eclipse.jdt.core.compiler.*;resolution:=optional, com.sun.el;resolution:=optional, com.sun.el.lang;resolution:=optional, com.sun.el.parser;resolution:=optional, @@ -125,20 +73,20 @@ javax.servlet.jsp.jstl.fmt;version="1.2";resolution:=optional, javax.servlet.jsp.jstl.sql;version="1.2";resolution:=optional, javax.servlet.jsp.jstl.tlv;version="1.2";resolution:=optional, - org.apache.el;version="[8.0.9,9)";resolution:=optional, - org.apache.el.lang;version="[8.0.9,9)";resolution:=optional, - org.apache.el.stream;version="[8.0.9,9)";resolution:=optional, - org.apache.el.util;version="[8.0.9,9)";resolution:=optional, - org.apache.el.parser;version="[8.0.9,9)";resolution:=optional, - org.apache.jasper;version="[8.0.9,9)";resolution:=optional, - org.apache.jasper.compiler;version="[8.0.9,9)";resolution:=optional, - org.apache.jasper.compiler.tagplugin;version="[8.0.9,9)";resolution:=optional, - org.apache.jasper.runtime;version="[8.0.9,9)";resolution:=optional, - org.apache.jasper.security;version="[8.0.9,9)";resolution:=optional, - org.apache.jasper.servlet;version="[8.0.9,9)";resolution:=optional, - org.apache.jasper.tagplugins.jstl;version="[8.0.9,9)";resolution:=optional, - org.apache.jasper.util;version="[8.0.9,9)";resolution:=optional, - org.apache.jasper.xmlparser;version="[8.0.9,9)";resolution:=optional, + org.apache.el;version="[8.0.23,9)";resolution:=optional, + org.apache.el.lang;version="[8.0.23,9)";resolution:=optional, + org.apache.el.stream;version="[8.0.23,9)";resolution:=optional, + org.apache.el.util;version="[8.0.23,9)";resolution:=optional, + org.apache.el.parser;version="[8.0.23,9)";resolution:=optional, + org.apache.jasper;version="[8.0.23,9)";resolution:=optional, + org.apache.jasper.compiler;version="[8.0.23,9)";resolution:=optional, + org.apache.jasper.compiler.tagplugin;version="[8.0.23,9)";resolution:=optional, + org.apache.jasper.runtime;version="[8.0.23,9)";resolution:=optional, + org.apache.jasper.security;version="[8.0.23,9)";resolution:=optional, + org.apache.jasper.servlet;version="[8.0.23,9)";resolution:=optional, + org.apache.jasper.tagplugins.jstl;version="[8.0.23,9)";resolution:=optional, + org.apache.jasper.util;version="[8.0.23,9)";resolution:=optional, + org.apache.jasper.xmlparser;version="[8.0.23,9)";resolution:=optional, org.apache.taglibs.standard;version="1.2";resolution:=optional, org.apache.taglibs.standard.extra.spath;version="1.2";resolution:=optional, org.apache.taglibs.standard.functions;version="1.2";resolution:=optional, @@ -162,8 +110,8 @@ org.apache.taglibs.standard.tag.rt.xml;version="1.2";resolution:=optional, org.apache.taglibs.standard.tei;version="1.2";resolution:=optional, org.apache.taglibs.standard.tlv;version="1.2";resolution:=optional, - org.apache.tomcat;version="[8.0.9,9)";resolution:=optional, - org.eclipse.jetty.jsp;version="[9.2,10)";resolution:=optional, + org.apache.tomcat;version="[8.0.23,9)";resolution:=optional, + org.eclipse.jetty.jsp;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:=optional, org.osgi.*, org.xml.*;resolution:=optional, org.xml.sax.*;resolution:=optional, @@ -172,8 +120,7 @@ org.w3c.dom.ls;resolution:=optional, javax.xml.parser;resolution:=optional - <_nouses>true - org.eclipse.jetty.jsp.*;version="9.2.6",org.apache.jasper.*;version="8.0.9",org.apache.el.*;version="8.0.9" + org.eclipse.jetty.jsp.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))",org.apache.jasper.*;version="8.0.23",org.apache.el.*;version="8.0.23" diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index f77a88299f0..1acf13b628f 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml 4.0.0 @@ -19,49 +19,17 @@ jetty-util - org.eclipse.osgi - org.eclipse.osgi + org.eclipse.osgi + org.eclipse.osgi - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - test-jar - - test-jar - - - - - - target/classes/META-INF/MANIFEST.MF - - - org.apache.felix maven-bundle-plugin true - - - bundle-manifest - process-classes - - manifest - - - RFC66 War URL diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index e74110a8e3a..d5e0c154496 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-osgi-boot @@ -30,8 +30,8 @@ jetty-jmx - org.eclipse.osgi - org.eclipse.osgi + org.eclipse.osgi + org.eclipse.osgi org.eclipse.osgi @@ -62,47 +62,15 @@
- - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - test-jar - - test-jar - - - - - - target/classes/META-INF/MANIFEST.MF - - - org.apache.felix maven-bundle-plugin true - - - bundle-manifest - process-classes - - manifest - - - org.eclipse.jetty.osgi.boot;singleton:=true org.eclipse.jetty.osgi.boot.JettyBootstrapActivator - org.eclipse.jetty.*;version="[9.1,10.0)" + org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))" javax.mail;version="1.4.0";resolution:=optional, javax.mail.event;version="1.4.0";resolution:=optional, javax.mail.internet;version="1.4.0";resolution:=optional, @@ -112,8 +80,6 @@ javax.servlet.http;version="[3.1,3.2)", javax.transaction;version="1.1.0";resolution:=optional, javax.transaction.xa;version="1.1.0";resolution:=optional, - org.eclipse.jetty.annotations;version="9.1";resolution:=optional, - org.eclipse.jetty.plus.webapp;version="9.1";resolution:=optional, org.objectweb.asm;version=4;resolution:=optional, org.osgi.framework, org.osgi.service.cm;version="1.2.0", @@ -126,6 +92,7 @@ org.slf4j.helpers;resolution:=optional, org.xml.sax, org.xml.sax.helpers, + org.eclipse.jetty.annotations;resolution:=optional, * <_nouses>true diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index 5910a343edf..27f78a15073 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-httpservice @@ -56,42 +56,10 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - test-jar - - test-jar - - - - - - target/classes/META-INF/MANIFEST.MF - - - org.apache.felix maven-bundle-plugin true - - - bundle-manifest - process-classes - - manifest - - - org.eclipse.jetty.osgi.httpservice diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index 3db092a3ed9..29a46dd3466 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -1,15 +1,19 @@ - - 4.0.0 + org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT + + 4.0.0 org.eclipse.jetty.osgi jetty-osgi-project Jetty :: OSGi http://www.eclipse.org/jetty pom + 3.6.0.v20100517 3.2.100.v20100503 @@ -18,6 +22,7 @@ 0.9.29 1.6.1 + jetty-osgi-boot jetty-osgi-boot-jsp @@ -25,22 +30,23 @@ jetty-osgi-httpservice test-jetty-osgi-webapp test-jetty-osgi-context - test-jetty-osgi + test-jetty-osgi-fragment + test-jetty-osgi-server jetty-osgi-alpn + - npn + jdk8 - 1.7 + [1.8,1.9) - + test-jetty-osgi + @@ -72,7 +78,6 @@ org.apache.maven.plugins maven-eclipse-plugin - 2.8 prevent/overwriting/by/pointing/to/nonexisting/MANIFEST.MF true @@ -91,6 +96,7 @@
+ @@ -192,4 +198,5 @@ + diff --git a/jetty-osgi/test-jetty-osgi-context/pom.xml b/jetty-osgi/test-jetty-osgi-context/pom.xml index 926d7595201..f26d0d126eb 100644 --- a/jetty-osgi/test-jetty-osgi-context/pom.xml +++ b/jetty-osgi/test-jetty-osgi-context/pom.xml @@ -2,11 +2,11 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 test-jetty-osgi-context - Jetty :: OSGi :: Context + Jetty :: OSGi :: Test Context Test Jetty OSGi bundle with a ContextHandler http://www.eclipse.org/jetty @@ -19,87 +19,55 @@ ${project.version} - org.eclipse.osgi - org.eclipse.osgi - provided + org.eclipse.osgi + org.eclipse.osgi + provided - org.eclipse.osgi - org.eclipse.osgi.services - provided + org.eclipse.osgi + org.eclipse.osgi.services + provided - org.eclipse.jetty.toolchain - jetty-schemas + org.eclipse.jetty.toolchain + jetty-schemas - - - - src/main/resources - - - src/main/context - - + + + + src/main/resources + + + src/main/context + + - - - org.apache.maven.plugins - maven-deploy-plugin - - - true - - - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - test-jar - - test-jar - - - - - - target/classes/META-INF/MANIFEST.MF - - - - - org.apache.felix - maven-bundle-plugin - true - - - bundle-manifest - process-classes - - manifest - - - - - - org.eclipse.jetty.osgi.testcontext;singleton:=true - Jetty OSGi Test Context - com.acme.osgi.Activator - J2SE-1.5 - - <_nouses>true - + + + org.apache.maven.plugins + maven-deploy-plugin + + + true + + + + org.apache.felix + maven-bundle-plugin + true + + + org.eclipse.jetty.osgi.testcontext;singleton:=true + Jetty OSGi Test Context + com.acme.osgi.Activator + J2SE-1.5 + + <_nouses>true + javax.servlet;version="[3.1,3.2)", javax.servlet.resources;version="[3.1,3.2)", org.osgi.framework, @@ -109,17 +77,17 @@ org.osgi.service.url;version="1.0.0", org.osgi.util.tracker;version="1.3.0", org.slf4j;resolution:=optional, - org.slf4j.spi;resolution:=optional, + org.slf4j.spi;resolution:=optional, org.slf4j.helpers;resolution:=optional, org.xml.sax, org.xml.sax.helpers, * - - org.eclipse.jetty.*;version="[9.1,10.0)" - - - - - - + + org.eclipse.jetty.*;version="[9.1,10.0)" + + +
+
+
+ diff --git a/jetty-osgi/test-jetty-osgi-webapp/pom.xml b/jetty-osgi/test-jetty-osgi-webapp/pom.xml index 4a5b18702c9..e990fb5edb2 100644 --- a/jetty-osgi/test-jetty-osgi-webapp/pom.xml +++ b/jetty-osgi/test-jetty-osgi-webapp/pom.xml @@ -2,12 +2,12 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml 4.0.0 test-jetty-osgi-webapp - Jetty :: OSGi :: WebApp + Jetty :: OSGi :: Test WebApp Test Jetty OSGi Webapp bundle http://www.eclipse.org/jetty @@ -19,80 +19,47 @@ jetty-webapp - org.eclipse.osgi - org.eclipse.osgi - provided + org.eclipse.osgi + org.eclipse.osgi + provided - org.eclipse.osgi - org.eclipse.osgi.services - provided + org.eclipse.osgi + org.eclipse.osgi.services + provided - - - - src/main/resources - - + + + + src/main/resources + + - - - org.apache.maven.plugins - maven-deploy-plugin - - - true - - - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - test-jar - - test-jar - - - - - - target/classes/META-INF/MANIFEST.MF - - - - - org.apache.felix - maven-bundle-plugin - true - - - bundle-manifest - process-classes - - manifest - - - - - - org.eclipse.jetty.osgi.testapp;singleton:=true - Jetty OSGi Test WebApp - com.acme.osgi.Activator - J2SE-1.5 - - <_nouses>true - + + + org.apache.maven.plugins + maven-deploy-plugin + + + true + + + + org.apache.felix + maven-bundle-plugin + true + + + org.eclipse.jetty.osgi.testapp;singleton:=true + Jetty OSGi Test WebApp + com.acme.osgi.Activator + J2SE-1.5 + + org.osgi.framework, org.osgi.service.cm;version="1.2.0", org.osgi.service.packageadmin, @@ -100,17 +67,17 @@ org.osgi.service.url;version="1.0.0", org.osgi.util.tracker;version="1.3.0", org.slf4j;resolution:=optional, - org.slf4j.spi;resolution:=optional, + org.slf4j.spi;resolution:=optional, org.slf4j.helpers;resolution:=optional, org.xml.sax, org.xml.sax.helpers, * - - org.eclipse.jetty.*;version="[9.1,10.0)" - - - - - - + + com.acme.osgi + org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))" + + +
+
+
diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index 9517cb5d81b..ea65b0740af 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml 4.0.0 @@ -11,16 +11,15 @@ Jetty OSGi Integration test http://www.eclipse.org/jetty - ${project.groupId}.boot.test.spdy + ${project.groupId}.boot.test.osgi http://download.eclipse.org/jetty/orbit/ target/distribution - 3.5.0 - 1.5.2 + 4.10.0 + 2.5.2 1.0 - org.ops4j.pax.exam pax-exam @@ -33,16 +32,13 @@ ${exam.version} test - - - + org.ops4j.pax.exam pax-exam-container-forked ${exam.version} test - org.ops4j.pax.exam pax-exam-junit4 @@ -68,34 +64,19 @@ test - - - - org.eclipse - osgi - 3.10.0-v20140606-1445 - test - - - org.eclipse.osgi + org.eclipse.platform org.eclipse.osgi.services + 3.5.100 test - org.eclipse.jetty.osgi @@ -129,7 +110,6 @@ - org.eclipse.jetty.osgi jetty-httpservice @@ -142,14 +122,12 @@ jetty-osgi-servlet-api 3.1.0.M3 - org.apache.geronimo.specs geronimo-jta_1.1_spec 1.1.1 test - org.apache.geronimo.specs geronimo-atinject_1.0_spec @@ -162,14 +140,44 @@ 1.0.1 test - - org.mortbay.jasper - apache-el - 8.0.33 - test + org.glassfish.web + javax.servlet.jsp.jstl + 1.2.2 + + + javax.servlet.jsp.jstl + jstl-api + + + javax.servlet + servlet-api + + + javax.servlet.jsp + jsp-api + + + javax.el + el-api + + + + + org.eclipse.jetty.orbit + javax.servlet.jsp.jstl + 1.2.0.v201105211821 + + + org.eclipse.jetty.orbit + javax.servlet + + + org.eclipse.jetty.orbit + javax.servlet.jsp + + - @@ -223,6 +231,7 @@ org.eclipse.jetty jetty-util + ${project.version} runtime @@ -279,34 +288,14 @@ runtime - org.eclipse.jetty.spdy - spdy-core + org.eclipse.jetty.http2 + http2-server ${project.version} - test - org.eclipse.jetty.spdy - spdy-server + org.eclipse.jetty.http2 + http2-hpack ${project.version} - test - - - org.eclipse.jetty.spdy - spdy-http-server - ${project.version} - test - - - org.eclipse.jetty.spdy - spdy-client - ${project.version} - test - - - org.mortbay.jetty.alpn - alpn-boot - ${alpn.version} - test org.eclipse.jetty.osgi @@ -325,8 +314,6 @@ jetty-schemas runtime - - org.eclipse.jetty jetty-plus @@ -342,7 +329,6 @@ webbundle test - org.eclipse.jetty.tests test-spec-webapp @@ -350,21 +336,29 @@ war test - org.eclipse.jetty.tests test-container-initializer ${project.version} test - - + + org.eclipse.jetty.osgi + test-jetty-osgi-fragment + ${project.version} + test + + + org.eclipse.jetty.osgi + test-jetty-osgi-server + ${project.version} + test + org.eclipse.jetty.tests test-mock-resources ${project.version} - org.eclipse.jetty.osgi test-jetty-osgi-context @@ -382,30 +376,28 @@ jetty-test-helper test + + org.slf4j + slf4j-log4j12 + ${slf4j-version} + test + maven-surefire-plugin + + 2.18.1 - + -Dmortbay-alpn-boot=${settings.localRepository}/org/mortbay/jetty/alpn/alpn-boot/${alpn.version}/alpn-boot-${alpn.version}.jar - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.7 - 1.7 - - org.apache.servicemix.tooling depends-maven-plugin - 1.2 generate-depends-file diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 80badafa981..a38401861ac 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-plus @@ -14,59 +14,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - <_nouses>true - - javax.sql.*,javax.security.*,javax.naming.*, - javax.servlet.*;version="[2.6.0,3.2)",javax.transaction.*;version="[1.1,1.3)", - * - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - diff --git a/jetty-proxy/pom.xml b/jetty-proxy/pom.xml index 8649f2fdb0e..e8da166ed0d 100644 --- a/jetty-proxy/pom.xml +++ b/jetty-proxy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-proxy @@ -14,52 +14,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.servlet.*;version="[2.6.0,3.2)",* - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - org.codehaus.mojo findbugs-maven-plugin @@ -97,6 +51,13 @@ ${project.version} test + + org.eclipse.jetty + jetty-http + ${project.version} + tests + test + org.eclipse.jetty.toolchain jetty-test-helper diff --git a/jetty-quickstart/pom.xml b/jetty-quickstart/pom.xml index e073299b9a1..a5db7eaa094 100644 --- a/jetty-quickstart/pom.xml +++ b/jetty-quickstart/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 org.eclipse.jetty @@ -10,6 +10,9 @@ Jetty :: Quick Start Jetty Quick Start http://www.eclipse.org/jetty + + ${project.groupId}.quickstart + org.eclipse.jetty @@ -79,26 +82,14 @@ ${project.version} test + + org.eclipse.jetty.toolchain + jetty-test-helper + test + - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index 2010c7eb23f..0d1964f4d40 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-rewrite @@ -14,52 +14,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.servlet.*;version="[2.6.0,3.2)",* - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - org.codehaus.mojo findbugs-maven-plugin diff --git a/jetty-runner/pom.xml b/jetty-runner/pom.xml index db123b2d10e..29be2959a66 100644 --- a/jetty-runner/pom.xml +++ b/jetty-runner/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-runner @@ -10,6 +10,7 @@ target/distribution + ${project.groupId}.runner http://www.eclipse.org/jetty @@ -20,7 +21,7 @@ unpack-dependencies - package + prepare-package unpack-dependencies @@ -35,42 +36,46 @@ - org.apache.maven.plugins - maven-jar-plugin - - - package - package - - jar - - - - - org.eclipse.jetty.runner.Runner - - - development - http://eclipse.org/jetty - ${user.name} - org.eclipse.jetty.runner - Jetty Runner - Mort Bay Consulting - - - - - - + org.apache.felix + maven-bundle-plugin + true + + + + manifest + + + + + + org.eclipse.jetty.runner.Runner + !* + + + + - org.apache.felix - maven-bundle-plugin - true + org.apache.maven.plugins + maven-jar-plugin - true + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + + org.neo4j.build.plugins + clirr-maven-plugin + + + true + + + + @@ -99,10 +104,15 @@ jetty-jndi ${project.version} - - org.eclipse.jetty - jetty-jsp - ${project.version} - + + org.eclipse.jetty + apache-jsp + ${project.version} + + + org.eclipse.jetty + apache-jstl + ${project.version} + diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 46314705c18..6d710c82a4a 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-security @@ -25,42 +25,13 @@ - javax.servlet.*;version="[2.6.0,3.2)",javax.security.cert,* + javax.servlet.*;version="[2.6.0,3.2)",javax.security.cert,org.eclipse.jetty*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))",* - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.codehaus.mojo findbugs-maven-plugin diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/AliasedConstraintTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/AliasedConstraintTest.java index b14d0232172..5237cc3e2b6 100644 --- a/jetty-security/src/test/java/org/eclipse/jetty/security/AliasedConstraintTest.java +++ b/jetty-security/src/test/java/org/eclipse/jetty/security/AliasedConstraintTest.java @@ -1,184 +1,184 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.security; - -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.startsWith; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.jetty.http.HttpStatus; -import org.eclipse.jetty.server.Connector; -import org.eclipse.jetty.server.Handler; -import org.eclipse.jetty.server.LocalConnector; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.handler.ContextHandler; -import org.eclipse.jetty.server.handler.DefaultHandler; -import org.eclipse.jetty.server.handler.HandlerList; -import org.eclipse.jetty.server.handler.ResourceHandler; -import org.eclipse.jetty.server.session.SessionHandler; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.eclipse.jetty.util.security.Constraint; -import org.eclipse.jetty.util.security.Password; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameter; -import org.junit.runners.Parameterized.Parameters; - -/** - * Some requests for static data that is served by ResourceHandler, but some is secured. - *

- * This is mainly here to test security bypass techniques using aliased names that should be caught. - */ -@RunWith(Parameterized.class) -public class AliasedConstraintTest -{ - private static final String TEST_REALM = "TestRealm"; - private static Server server; - private static LocalConnector connector; - private static ConstraintSecurityHandler security; - - - @BeforeClass - public static void startServer() throws Exception - { - server = new Server(); - connector = new LocalConnector(server); - server.setConnectors(new Connector[] { connector }); - - ContextHandler context = new ContextHandler(); - SessionHandler session = new SessionHandler(); - - TestLoginService loginService = new TestLoginService(TEST_REALM); - - loginService.putUser("user0",new Password("password"),new String[] {}); - loginService.putUser("user",new Password("password"),new String[] { "user" }); - loginService.putUser("user2",new Password("password"),new String[] { "user" }); - loginService.putUser("admin",new Password("password"),new String[] { "user", "administrator" }); - loginService.putUser("user3",new Password("password"),new String[] { "foo" }); - - context.setContextPath("/ctx"); - context.setResourceBase(MavenTestingUtils.getTestResourceDir("docroot").getAbsolutePath()); - - HandlerList handlers = new HandlerList(); - handlers.setHandlers(new Handler[]{context,new DefaultHandler()}); - server.setHandler(handlers); - context.setHandler(session); - // context.addAliasCheck(new AllowSymLinkAliasChecker()); - - server.addBean(loginService); - - security = new ConstraintSecurityHandler(); - session.setHandler(security); - ResourceHandler handler = new ResourceHandler(); - security.setHandler(handler); - - List constraints = new ArrayList<>(); - - Constraint constraint0 = new Constraint(); - constraint0.setAuthenticate(true); - constraint0.setName("forbid"); - ConstraintMapping mapping0 = new ConstraintMapping(); - mapping0.setPathSpec("/forbid/*"); - mapping0.setConstraint(constraint0); - constraints.add(mapping0); - - Set knownRoles = new HashSet<>(); - knownRoles.add("user"); - knownRoles.add("administrator"); - - security.setConstraintMappings(constraints,knownRoles); - server.start(); - } - - @AfterClass - public static void stopServer() throws Exception - { - server.stop(); - } - - @Parameters(name = "{0}: {1}") - public static Collection data() - { - List data = new ArrayList<>(); - - final String OPENCONTENT = "this is open content"; - - data.add(new Object[] { "/ctx/all/index.txt", HttpStatus.OK_200, OPENCONTENT }); - data.add(new Object[] { "/ctx/ALL/index.txt", HttpStatus.NOT_FOUND_404, null }); - data.add(new Object[] { "/ctx/ALL/Fred/../index.txt", HttpStatus.NOT_FOUND_404, null }); - data.add(new Object[] { "/ctx/../bar/../ctx/all/index.txt", HttpStatus.OK_200, OPENCONTENT }); - data.add(new Object[] { "/ctx/forbid/index.txt", HttpStatus.FORBIDDEN_403, null }); - data.add(new Object[] { "/ctx/all/../forbid/index.txt", HttpStatus.FORBIDDEN_403, null }); - data.add(new Object[] { "/ctx/FoRbId/index.txt", HttpStatus.NOT_FOUND_404, null }); - - return data; - } - - @Parameter(value = 0) - public String uri; - - @Parameter(value = 1) - public int expectedStatusCode; - - @Parameter(value = 2) - public String expectedContent; - - @Test - public void testAccess() throws Exception - { - StringBuilder request = new StringBuilder(); - request.append("GET ").append(uri).append(" HTTP/1.1\r\n"); - request.append("Host: localhost\r\n"); - request.append("Connection: close\r\n"); - request.append("\r\n"); - - String response = connector.getResponse(request.toString()); - - switch (expectedStatusCode) - { - case 200: - assertThat(response,startsWith("HTTP/1.1 200 OK")); - break; - case 403: - assertThat(response,startsWith("HTTP/1.1 403 Forbidden")); - break; - case 404: - assertThat(response,startsWith("HTTP/1.1 404 Not Found")); - break; - default: - fail("Write a handler for response status code: " + expectedStatusCode); - break; - } - - if (expectedContent != null) - { - assertThat(response,containsString("this is open content")); - } - } -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.security; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.startsWith; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jetty.http.HttpStatus; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.LocalConnector; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.ContextHandler; +import org.eclipse.jetty.server.handler.DefaultHandler; +import org.eclipse.jetty.server.handler.HandlerList; +import org.eclipse.jetty.server.handler.ResourceHandler; +import org.eclipse.jetty.server.session.SessionHandler; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; +import org.eclipse.jetty.util.security.Constraint; +import org.eclipse.jetty.util.security.Password; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +/** + * Some requests for static data that is served by ResourceHandler, but some is secured. + *

+ * This is mainly here to test security bypass techniques using aliased names that should be caught. + */ +@RunWith(Parameterized.class) +public class AliasedConstraintTest +{ + private static final String TEST_REALM = "TestRealm"; + private static Server server; + private static LocalConnector connector; + private static ConstraintSecurityHandler security; + + + @BeforeClass + public static void startServer() throws Exception + { + server = new Server(); + connector = new LocalConnector(server); + server.setConnectors(new Connector[] { connector }); + + ContextHandler context = new ContextHandler(); + SessionHandler session = new SessionHandler(); + + TestLoginService loginService = new TestLoginService(TEST_REALM); + + loginService.putUser("user0",new Password("password"),new String[] {}); + loginService.putUser("user",new Password("password"),new String[] { "user" }); + loginService.putUser("user2",new Password("password"),new String[] { "user" }); + loginService.putUser("admin",new Password("password"),new String[] { "user", "administrator" }); + loginService.putUser("user3",new Password("password"),new String[] { "foo" }); + + context.setContextPath("/ctx"); + context.setResourceBase(MavenTestingUtils.getTestResourceDir("docroot").getAbsolutePath()); + + HandlerList handlers = new HandlerList(); + handlers.setHandlers(new Handler[]{context,new DefaultHandler()}); + server.setHandler(handlers); + context.setHandler(session); + // context.addAliasCheck(new AllowSymLinkAliasChecker()); + + server.addBean(loginService); + + security = new ConstraintSecurityHandler(); + session.setHandler(security); + ResourceHandler handler = new ResourceHandler(); + security.setHandler(handler); + + List constraints = new ArrayList<>(); + + Constraint constraint0 = new Constraint(); + constraint0.setAuthenticate(true); + constraint0.setName("forbid"); + ConstraintMapping mapping0 = new ConstraintMapping(); + mapping0.setPathSpec("/forbid/*"); + mapping0.setConstraint(constraint0); + constraints.add(mapping0); + + Set knownRoles = new HashSet<>(); + knownRoles.add("user"); + knownRoles.add("administrator"); + + security.setConstraintMappings(constraints,knownRoles); + server.start(); + } + + @AfterClass + public static void stopServer() throws Exception + { + server.stop(); + } + + @Parameters(name = "{0}: {1}") + public static Collection data() + { + List data = new ArrayList<>(); + + final String OPENCONTENT = "this is open content"; + + data.add(new Object[] { "/ctx/all/index.txt", HttpStatus.OK_200, OPENCONTENT }); + data.add(new Object[] { "/ctx/ALL/index.txt", HttpStatus.NOT_FOUND_404, null }); + data.add(new Object[] { "/ctx/ALL/Fred/../index.txt", HttpStatus.NOT_FOUND_404, null }); + data.add(new Object[] { "/ctx/../bar/../ctx/all/index.txt", HttpStatus.OK_200, OPENCONTENT }); + data.add(new Object[] { "/ctx/forbid/index.txt", HttpStatus.FORBIDDEN_403, null }); + data.add(new Object[] { "/ctx/all/../forbid/index.txt", HttpStatus.FORBIDDEN_403, null }); + data.add(new Object[] { "/ctx/FoRbId/index.txt", HttpStatus.NOT_FOUND_404, null }); + + return data; + } + + @Parameter(value = 0) + public String uri; + + @Parameter(value = 1) + public int expectedStatusCode; + + @Parameter(value = 2) + public String expectedContent; + + @Test + public void testAccess() throws Exception + { + StringBuilder request = new StringBuilder(); + request.append("GET ").append(uri).append(" HTTP/1.1\r\n"); + request.append("Host: localhost\r\n"); + request.append("Connection: close\r\n"); + request.append("\r\n"); + + String response = connector.getResponse(request.toString()); + + switch (expectedStatusCode) + { + case 200: + assertThat(response,startsWith("HTTP/1.1 200 OK")); + break; + case 403: + assertThat(response,startsWith("HTTP/1.1 403 Forbidden")); + break; + case 404: + assertThat(response,startsWith("HTTP/1.1 404 Not Found")); + break; + default: + fail("Write a handler for response status code: " + expectedStatusCode); + break; + } + + if (expectedContent != null) + { + assertThat(response,containsString("this is open content")); + } + } +} diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index 233ca5c06de..ccbf03688a3 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-server @@ -14,35 +14,10 @@ - - org.apache.felix - maven-bundle-plugin - true - - - generate-manifest - - manifest - - - - javax.servlet.*;version="[2.6.0,3.2)",org.eclipse.jetty.jmx.*;version="9.1";resolution:=optional,* - <_nouses>true - - - - - org.apache.maven.plugins maven-jar-plugin - - artifact-jar - - jar - - test-jar @@ -50,28 +25,6 @@ - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - org.codehaus.mojo @@ -83,18 +36,9 @@ - - org.eclipse.jetty.toolchain - jetty-test-helper - test - javax.servlet javax.servlet-api - org.eclipse.jetty @@ -119,9 +63,16 @@ true - org.mockito - mockito-core + org.eclipse.jetty.toolchain + jetty-test-helper test - + + + org.eclipse.jetty + jetty-http + ${project.version} + tests + test + diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java index f5524572669..9259a3fbb48 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/LocalConnector.java @@ -378,6 +378,16 @@ public class LocalConnector extends AbstractConnector } } } + + /** + * Remaining output ByteBuffer after calls to {@link #getResponse()} or {@link #waitForResponse(boolean, long, TimeUnit)} + * + * @return the remaining response data buffer + */ + public ByteBuffer getResponseData() + { + return _responseData; + } /** * Wait for a response using a parser to detect the end of message @@ -515,7 +525,7 @@ public class LocalConnector extends AbstractConnector } } } - + if (bout.getCount()==0 && isOutputShutdown()) return null; return ByteBuffer.wrap(bout.getBuf(),0,bout.getCount()); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java index d89088a6634..10370b20d08 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java @@ -57,17 +57,8 @@ import org.hamcrest.Matchers; import org.junit.Assert; import org.junit.Test; -import static org.hamcrest.Matchers.anyOf; -import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; - public class ServerConnectorTest { public static class ReuseInfoHandler extends AbstractHandler diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 7d4d1698d2f..2ff8909c825 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-servlet @@ -16,34 +16,8 @@ - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.servlet.*;version="[2.6.0,3.2)",org.eclipse.jetty.jmx.*;version="9.1";resolution:=optional,* - <_nouses>true - - - - - - - org.apache.maven.plugins maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - tests @@ -53,23 +27,6 @@ - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - org.codehaus.mojo findbugs-maven-plugin @@ -96,5 +53,12 @@ jetty-test-helper test + + org.eclipse.jetty + jetty-http + ${project.version} + tests + test + diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index 6b9e284b022..254631b857f 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-servlets @@ -15,52 +15,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.servlet.*;version="[2.6.0,3.2)",* - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - org.codehaus.mojo findbugs-maven-plugin @@ -108,6 +62,20 @@ ${project.version} test + + org.eclipse.jetty + jetty-http + ${project.version} + tests + test + + + org.eclipse.jetty + jetty-servlet + ${project.version} + tests + test + org.eclipse.jetty.toolchain jetty-test-helper 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 9df5e0c79e0..c0a138112ec 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 @@ -1,407 +1,407 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.servlets; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; -import java.nio.ByteBuffer; -import java.nio.channels.SelectionKey; -import java.nio.channels.SocketChannel; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.Exchanger; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicInteger; - -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.SocketChannelEndPoint; -import org.eclipse.jetty.server.HttpChannel; -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.server.handler.AbstractHandler; -import org.eclipse.jetty.servlet.DefaultServlet; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.eclipse.jetty.toolchain.test.TestTracker; -import org.eclipse.jetty.toolchain.test.annotation.Slow; -import org.eclipse.jetty.util.log.StacklessLogging; -import org.eclipse.jetty.util.thread.QueuedThreadPool; -import org.junit.After; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; - -public class ThreadStarvationTest -{ - @Rule - public TestTracker tracker = new TestTracker(); - private Server _server; - - @After - public void dispose() throws Exception - { - if (_server != null) - _server.stop(); - } - - @Test - @Slow - public void testDefaultServletSuccess() throws Exception - { - int maxThreads = 10; - QueuedThreadPool threadPool = new QueuedThreadPool(maxThreads, maxThreads); - threadPool.setDetailedDump(true); - _server = new Server(threadPool); - - // Prepare a big file to download. - File directory = MavenTestingUtils.getTargetTestingDir(); - Files.createDirectories(directory.toPath()); - String resourceName = "resource.bin"; - Path resourcePath = Paths.get(directory.getPath(), resourceName); - try (OutputStream output = Files.newOutputStream(resourcePath, StandardOpenOption.CREATE, StandardOpenOption.WRITE)) - { - byte[] chunk = new byte[1024]; - Arrays.fill(chunk,(byte)'X'); - chunk[chunk.length-2]='\r'; - chunk[chunk.length-1]='\n'; - for (int i = 0; i < 256 * 1024; ++i) - output.write(chunk); - } - - final CountDownLatch writePending = new CountDownLatch(1); - ServerConnector connector = new ServerConnector(_server, 0, 1) - { - @Override - protected ChannelEndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey key) throws IOException - { - return new SocketChannelEndPoint(channel, selectSet, key, getScheduler()) - { - @Override - protected void onIncompleteFlush() - { - super.onIncompleteFlush(); - writePending.countDown(); - } - }; - } - }; - connector.setIdleTimeout(Long.MAX_VALUE); - _server.addConnector(connector); - - ServletContextHandler context = new ServletContextHandler(_server, "/"); - context.setResourceBase(directory.toURI().toString()); - context.addServlet(DefaultServlet.class, "/*").setAsyncSupported(false); - _server.setHandler(context); - - _server.start(); - - List sockets = new ArrayList<>(); - for (int i = 0; i < maxThreads*2; ++i) - { - Socket socket = new Socket("localhost", connector.getLocalPort()); - sockets.add(socket); - OutputStream output = socket.getOutputStream(); - String request = "" + - "GET /" + resourceName + " HTTP/1.1\r\n" + - "Host: localhost\r\n" + - "\r\n"; - output.write(request.getBytes(StandardCharsets.UTF_8)); - output.flush(); - Thread.sleep(100); - } - - // Wait for a the servlet to block. - Assert.assertTrue(writePending.await(5, TimeUnit.SECONDS)); - - long expected = Files.size(resourcePath); - byte[] buffer = new byte[48 * 1024]; - List> totals = new ArrayList<>(); - for (Socket socket : sockets) - { - final Exchanger x = new Exchanger<>(); - totals.add(x); - final InputStream input = socket.getInputStream(); - - new Thread() - { - @Override - public void run() - { - long total=0; - try - { - // look for CRLFCRLF - StringBuilder header = new StringBuilder(); - int state=0; - while (state<4 && header.length()<2048) - { - int ch=input.read(); - if (ch<0) - break; - header.append((char)ch); - switch(state) - { - case 0: - if (ch=='\r') - state=1; - break; - case 1: - if (ch=='\n') - state=2; - else - state=0; - break; - case 2: - if (ch=='\r') - state=3; - else - state=0; - break; - case 3: - if (ch=='\n') - state=4; - else - state=0; - break; - } - } - - while (total x : totals) - { - Long total = x.exchange(-1L,10000,TimeUnit.SECONDS); - Assert.assertEquals(expected,total.longValue()); - } - - // We could read everything, good. - for (Socket socket : sockets) - socket.close(); - } - - @Test - public void testFailureStarvation() throws Exception - { - try (StacklessLogging stackless = new StacklessLogging(HttpChannel.class)) - { - int acceptors = 0; - int selectors = 1; - int maxThreads = 10; - final int barried=maxThreads-acceptors-selectors*2; - final CyclicBarrier barrier = new CyclicBarrier(barried); - - - QueuedThreadPool threadPool = new QueuedThreadPool(maxThreads, maxThreads); - threadPool.setDetailedDump(true); - _server = new Server(threadPool); - - - ServerConnector connector = new ServerConnector(_server, acceptors, selectors) - { - @Override - protected ChannelEndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey key) throws IOException - { - return new SocketChannelEndPoint(channel, selectSet, key, getScheduler()) - { - @Override - public boolean flush(ByteBuffer... buffers) throws IOException - { - super.flush(buffers[0]); - throw new IOException("TEST FAILURE"); - } - }; - } - }; - connector.setIdleTimeout(Long.MAX_VALUE); - _server.addConnector(connector); - - final AtomicInteger count = new AtomicInteger(0); - _server.setHandler(new AbstractHandler() - { - @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - int c=count.getAndIncrement(); - try - { - if (c sockets = new ArrayList<>(); - for (int i = 0; i < maxThreads*2; ++i) - { - Socket socket = new Socket("localhost", connector.getLocalPort()); - sockets.add(socket); - OutputStream output = socket.getOutputStream(); - String request = "" + - "GET / HTTP/1.1\r\n" + - "Host: localhost\r\n" + - // "Connection: close\r\n" + - "\r\n"; - output.write(request.getBytes(StandardCharsets.UTF_8)); - output.flush(); - } - - byte[] buffer = new byte[48 * 1024]; - List> totals = new ArrayList<>(); - for (Socket socket : sockets) - { - final Exchanger x = new Exchanger<>(); - totals.add(x); - final InputStream input = socket.getInputStream(); - - new Thread() - { - @Override - public void run() - { - int read=0; - try - { - // look for CRLFCRLF - StringBuilder header = new StringBuilder(); - int state=0; - while (state<4 && header.length()<2048) - { - int ch=input.read(); - if (ch<0) - break; - header.append((char)ch); - switch(state) - { - case 0: - if (ch=='\r') - state=1; - break; - case 1: - if (ch=='\n') - state=2; - else - state=0; - break; - case 2: - if (ch=='\r') - state=3; - else - state=0; - break; - case 3: - if (ch=='\n') - state=4; - else - state=0; - break; - } - } - - read=input.read(buffer); - } - catch (IOException e) - { - // e.printStackTrace(); - } - finally - { - try - { - x.exchange(read); - } - catch (InterruptedException e) - { - e.printStackTrace(); - } - } - } - }.start(); - } - - for (Exchanger x : totals) - { - Integer read = x.exchange(-1,10,TimeUnit.SECONDS); - Assert.assertEquals(-1,read.intValue()); - } - - // We could read everything, good. - for (Socket socket : sockets) - socket.close(); - - _server.stop(); - } - } -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.servlets; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.Socket; +import java.nio.ByteBuffer; +import java.nio.channels.SelectionKey; +import java.nio.channels.SocketChannel; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.Exchanger; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicInteger; + +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.SocketChannelEndPoint; +import org.eclipse.jetty.server.HttpChannel; +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.servlet.DefaultServlet; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; +import org.eclipse.jetty.toolchain.test.TestTracker; +import org.eclipse.jetty.toolchain.test.annotation.Slow; +import org.eclipse.jetty.util.log.StacklessLogging; +import org.eclipse.jetty.util.thread.QueuedThreadPool; +import org.junit.After; +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; + +public class ThreadStarvationTest +{ + @Rule + public TestTracker tracker = new TestTracker(); + private Server _server; + + @After + public void dispose() throws Exception + { + if (_server != null) + _server.stop(); + } + + @Test + @Slow + public void testDefaultServletSuccess() throws Exception + { + int maxThreads = 10; + QueuedThreadPool threadPool = new QueuedThreadPool(maxThreads, maxThreads); + threadPool.setDetailedDump(true); + _server = new Server(threadPool); + + // Prepare a big file to download. + File directory = MavenTestingUtils.getTargetTestingDir(); + Files.createDirectories(directory.toPath()); + String resourceName = "resource.bin"; + Path resourcePath = Paths.get(directory.getPath(), resourceName); + try (OutputStream output = Files.newOutputStream(resourcePath, StandardOpenOption.CREATE, StandardOpenOption.WRITE)) + { + byte[] chunk = new byte[1024]; + Arrays.fill(chunk,(byte)'X'); + chunk[chunk.length-2]='\r'; + chunk[chunk.length-1]='\n'; + for (int i = 0; i < 256 * 1024; ++i) + output.write(chunk); + } + + final CountDownLatch writePending = new CountDownLatch(1); + ServerConnector connector = new ServerConnector(_server, 0, 1) + { + @Override + protected ChannelEndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey key) throws IOException + { + return new SocketChannelEndPoint(channel, selectSet, key, getScheduler()) + { + @Override + protected void onIncompleteFlush() + { + super.onIncompleteFlush(); + writePending.countDown(); + } + }; + } + }; + connector.setIdleTimeout(Long.MAX_VALUE); + _server.addConnector(connector); + + ServletContextHandler context = new ServletContextHandler(_server, "/"); + context.setResourceBase(directory.toURI().toString()); + context.addServlet(DefaultServlet.class, "/*").setAsyncSupported(false); + _server.setHandler(context); + + _server.start(); + + List sockets = new ArrayList<>(); + for (int i = 0; i < maxThreads*2; ++i) + { + Socket socket = new Socket("localhost", connector.getLocalPort()); + sockets.add(socket); + OutputStream output = socket.getOutputStream(); + String request = "" + + "GET /" + resourceName + " HTTP/1.1\r\n" + + "Host: localhost\r\n" + + "\r\n"; + output.write(request.getBytes(StandardCharsets.UTF_8)); + output.flush(); + Thread.sleep(100); + } + + // Wait for a the servlet to block. + Assert.assertTrue(writePending.await(5, TimeUnit.SECONDS)); + + long expected = Files.size(resourcePath); + byte[] buffer = new byte[48 * 1024]; + List> totals = new ArrayList<>(); + for (Socket socket : sockets) + { + final Exchanger x = new Exchanger<>(); + totals.add(x); + final InputStream input = socket.getInputStream(); + + new Thread() + { + @Override + public void run() + { + long total=0; + try + { + // look for CRLFCRLF + StringBuilder header = new StringBuilder(); + int state=0; + while (state<4 && header.length()<2048) + { + int ch=input.read(); + if (ch<0) + break; + header.append((char)ch); + switch(state) + { + case 0: + if (ch=='\r') + state=1; + break; + case 1: + if (ch=='\n') + state=2; + else + state=0; + break; + case 2: + if (ch=='\r') + state=3; + else + state=0; + break; + case 3: + if (ch=='\n') + state=4; + else + state=0; + break; + } + } + + while (total x : totals) + { + Long total = x.exchange(-1L,10000,TimeUnit.SECONDS); + Assert.assertEquals(expected,total.longValue()); + } + + // We could read everything, good. + for (Socket socket : sockets) + socket.close(); + } + + @Test + public void testFailureStarvation() throws Exception + { + try (StacklessLogging stackless = new StacklessLogging(HttpChannel.class)) + { + int acceptors = 0; + int selectors = 1; + int maxThreads = 10; + final int barried=maxThreads-acceptors-selectors*2; + final CyclicBarrier barrier = new CyclicBarrier(barried); + + + QueuedThreadPool threadPool = new QueuedThreadPool(maxThreads, maxThreads); + threadPool.setDetailedDump(true); + _server = new Server(threadPool); + + + ServerConnector connector = new ServerConnector(_server, acceptors, selectors) + { + @Override + protected ChannelEndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey key) throws IOException + { + return new SocketChannelEndPoint(channel, selectSet, key, getScheduler()) + { + @Override + public boolean flush(ByteBuffer... buffers) throws IOException + { + super.flush(buffers[0]); + throw new IOException("TEST FAILURE"); + } + }; + } + }; + connector.setIdleTimeout(Long.MAX_VALUE); + _server.addConnector(connector); + + final AtomicInteger count = new AtomicInteger(0); + _server.setHandler(new AbstractHandler() + { + @Override + public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException + { + int c=count.getAndIncrement(); + try + { + if (c sockets = new ArrayList<>(); + for (int i = 0; i < maxThreads*2; ++i) + { + Socket socket = new Socket("localhost", connector.getLocalPort()); + sockets.add(socket); + OutputStream output = socket.getOutputStream(); + String request = "" + + "GET / HTTP/1.1\r\n" + + "Host: localhost\r\n" + + // "Connection: close\r\n" + + "\r\n"; + output.write(request.getBytes(StandardCharsets.UTF_8)); + output.flush(); + } + + byte[] buffer = new byte[48 * 1024]; + List> totals = new ArrayList<>(); + for (Socket socket : sockets) + { + final Exchanger x = new Exchanger<>(); + totals.add(x); + final InputStream input = socket.getInputStream(); + + new Thread() + { + @Override + public void run() + { + int read=0; + try + { + // look for CRLFCRLF + StringBuilder header = new StringBuilder(); + int state=0; + while (state<4 && header.length()<2048) + { + int ch=input.read(); + if (ch<0) + break; + header.append((char)ch); + switch(state) + { + case 0: + if (ch=='\r') + state=1; + break; + case 1: + if (ch=='\n') + state=2; + else + state=0; + break; + case 2: + if (ch=='\r') + state=3; + else + state=0; + break; + case 3: + if (ch=='\n') + state=4; + else + state=0; + break; + } + } + + read=input.read(buffer); + } + catch (IOException e) + { + // e.printStackTrace(); + } + finally + { + try + { + x.exchange(read); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + } + }.start(); + } + + for (Exchanger x : totals) + { + Integer read = x.exchange(-1,10,TimeUnit.SECONDS); + Assert.assertEquals(-1,read.intValue()); + } + + // We could read everything, good. + for (Socket socket : sockets) + socket.close(); + + _server.stop(); + } + } +} diff --git a/jetty-spring/pom.xml b/jetty-spring/pom.xml index e01b95eba34..274d6e67152 100644 --- a/jetty-spring/pom.xml +++ b/jetty-spring/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-spring @@ -11,28 +11,12 @@ 3.2.8.RELEASE target/dependencies + ${project.groupId}.spring install - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - org.jacoco jacoco-maven-plugin diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index 5c0b6f5cb89..3500bbbe750 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,13 +2,17 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-start Jetty :: Start The start utility http://www.eclipse.org/jetty + + ${project.groupId}.start + start.jar + @@ -30,9 +34,6 @@ - - start.jar - org.eclipse.jetty.toolchain diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java index cd110dc6b20..e955a57691b 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java @@ -1,214 +1,214 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.start; - -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.startsWith; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jetty.start.config.ConfigSources; -import org.eclipse.jetty.start.config.JettyBaseConfigSource; -import org.eclipse.jetty.start.config.JettyHomeConfigSource; -import org.eclipse.jetty.toolchain.test.IO; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.junit.Assert; -import org.junit.Test; - -public class BaseHomeTest -{ - public static void assertPathList(BaseHome hb, String message, List expected, PathFinder finder) - { - List actual = new ArrayList<>(); - for (Path path : finder.getHits()) - { - actual.add(hb.toShortForm(path.toFile())); - } - - if (actual.size() != expected.size()) - { - System.out.printf("Actual Path(s): %,d hits%n",actual.size()); - for (String path : actual) - { - System.out.printf(" %s%n",path); - } - System.out.printf("Expected Path(s): %,d entries%n",expected.size()); - for (String path : expected) - { - System.out.printf(" %s%n",path); - } - } - Assert.assertThat(message + ": " + Utils.join(actual,", "),actual,containsInAnyOrder(expected.toArray())); - } - - public static void assertPathList(BaseHome hb, String message, List expected, List paths) - { - List actual = new ArrayList<>(); - for (Path path : paths) - { - actual.add(hb.toShortForm(path.toFile())); - } - - if (actual.size() != expected.size()) - { - System.out.printf("Actual Path(s): %,d hits%n",actual.size()); - for (String path : actual) - { - System.out.printf(" %s%n",path); - } - System.out.printf("Expected Path(s): %,d entries%n",expected.size()); - for (String path : expected) - { - System.out.printf(" %s%n",path); - } - } - Assert.assertThat(message + ": " + Utils.join(actual,", "),actual,containsInAnyOrder(expected.toArray())); - } - - public static void assertFileList(BaseHome hb, String message, List expected, List files) - { - List actual = new ArrayList<>(); - for (File file : files) - { - actual.add(hb.toShortForm(file)); - } - Assert.assertThat(message + ": " + Utils.join(actual,", "),actual,containsInAnyOrder(expected.toArray())); - } - - @Test - public void testGetPath_OnlyHome() throws IOException - { - File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); - - ConfigSources config = new ConfigSources(); - config.add(new JettyHomeConfigSource(homeDir.toPath())); - - BaseHome hb = new BaseHome(config); - Path startIni = hb.getPath("start.ini"); - - String ref = hb.toShortForm(startIni); - Assert.assertThat("Reference",ref,startsWith("${jetty.home}")); - - String contents = IO.readToString(startIni.toFile()); - Assert.assertThat("Contents",contents,containsString("Home Ini")); - } - - @Test - public void testGetPaths_OnlyHome() throws IOException - { - File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); - - ConfigSources config = new ConfigSources(); - config.add(new JettyHomeConfigSource(homeDir.toPath())); - - BaseHome hb = new BaseHome(config); - List paths = hb.getPaths("start.d/*"); - - List expected = new ArrayList<>(); - expected.add("${jetty.home}/start.d/jmx.ini"); - expected.add("${jetty.home}/start.d/jndi.ini"); - expected.add("${jetty.home}/start.d/jsp.ini"); - expected.add("${jetty.home}/start.d/logging.ini"); - expected.add("${jetty.home}/start.d/ssl.ini"); - FSTest.toOsSeparators(expected); - - assertPathList(hb,"Paths found",expected,paths); - } - - @Test - public void testGetPaths_OnlyHome_InisOnly() throws IOException - { - File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); - - ConfigSources config = new ConfigSources(); - config.add(new JettyHomeConfigSource(homeDir.toPath())); - - BaseHome hb = new BaseHome(config); - List paths = hb.getPaths("start.d/*.ini"); - - List expected = new ArrayList<>(); - expected.add("${jetty.home}/start.d/jmx.ini"); - expected.add("${jetty.home}/start.d/jndi.ini"); - expected.add("${jetty.home}/start.d/jsp.ini"); - expected.add("${jetty.home}/start.d/logging.ini"); - expected.add("${jetty.home}/start.d/ssl.ini"); - FSTest.toOsSeparators(expected); - - assertPathList(hb,"Paths found",expected,paths); - } - - @Test - public void testGetPaths_Both() throws IOException - { - File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); - File baseDir = MavenTestingUtils.getTestResourceDir("hb.1/base"); - - ConfigSources config = new ConfigSources(); - config.add(new JettyBaseConfigSource(baseDir.toPath())); - config.add(new JettyHomeConfigSource(homeDir.toPath())); - - BaseHome hb = new BaseHome(config); - List paths = hb.getPaths("start.d/*.ini"); - - List expected = new ArrayList<>(); - expected.add("${jetty.base}/start.d/jmx.ini"); - expected.add("${jetty.home}/start.d/jndi.ini"); - expected.add("${jetty.home}/start.d/jsp.ini"); - expected.add("${jetty.base}/start.d/logging.ini"); - expected.add("${jetty.home}/start.d/ssl.ini"); - expected.add("${jetty.base}/start.d/myapp.ini"); - FSTest.toOsSeparators(expected); - - assertPathList(hb,"Paths found",expected,paths); - } - - @Test - public void testDefault() throws IOException - { - BaseHome bh = new BaseHome(); - Assert.assertThat("Home",bh.getHome(),notNullValue()); - Assert.assertThat("Base",bh.getBase(),notNullValue()); - } - - @Test - public void testGetPath_Both() throws IOException - { - File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); - File baseDir = MavenTestingUtils.getTestResourceDir("hb.1/base"); - - ConfigSources config = new ConfigSources(); - config.add(new JettyBaseConfigSource(baseDir.toPath())); - config.add(new JettyHomeConfigSource(homeDir.toPath())); - - BaseHome hb = new BaseHome(config); - Path startIni = hb.getPath("start.ini"); - - String ref = hb.toShortForm(startIni); - Assert.assertThat("Reference",ref,startsWith("${jetty.base}")); - - String contents = IO.readToString(startIni.toFile()); - Assert.assertThat("Contents",contents,containsString("Base Ini")); - } -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start; + +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.startsWith; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jetty.start.config.ConfigSources; +import org.eclipse.jetty.start.config.JettyBaseConfigSource; +import org.eclipse.jetty.start.config.JettyHomeConfigSource; +import org.eclipse.jetty.toolchain.test.IO; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; +import org.junit.Assert; +import org.junit.Test; + +public class BaseHomeTest +{ + public static void assertPathList(BaseHome hb, String message, List expected, PathFinder finder) + { + List actual = new ArrayList<>(); + for (Path path : finder.getHits()) + { + actual.add(hb.toShortForm(path.toFile())); + } + + if (actual.size() != expected.size()) + { + System.out.printf("Actual Path(s): %,d hits%n",actual.size()); + for (String path : actual) + { + System.out.printf(" %s%n",path); + } + System.out.printf("Expected Path(s): %,d entries%n",expected.size()); + for (String path : expected) + { + System.out.printf(" %s%n",path); + } + } + Assert.assertThat(message + ": " + Utils.join(actual,", "),actual,containsInAnyOrder(expected.toArray())); + } + + public static void assertPathList(BaseHome hb, String message, List expected, List paths) + { + List actual = new ArrayList<>(); + for (Path path : paths) + { + actual.add(hb.toShortForm(path.toFile())); + } + + if (actual.size() != expected.size()) + { + System.out.printf("Actual Path(s): %,d hits%n",actual.size()); + for (String path : actual) + { + System.out.printf(" %s%n",path); + } + System.out.printf("Expected Path(s): %,d entries%n",expected.size()); + for (String path : expected) + { + System.out.printf(" %s%n",path); + } + } + Assert.assertThat(message + ": " + Utils.join(actual,", "),actual,containsInAnyOrder(expected.toArray())); + } + + public static void assertFileList(BaseHome hb, String message, List expected, List files) + { + List actual = new ArrayList<>(); + for (File file : files) + { + actual.add(hb.toShortForm(file)); + } + Assert.assertThat(message + ": " + Utils.join(actual,", "),actual,containsInAnyOrder(expected.toArray())); + } + + @Test + public void testGetPath_OnlyHome() throws IOException + { + File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); + + ConfigSources config = new ConfigSources(); + config.add(new JettyHomeConfigSource(homeDir.toPath())); + + BaseHome hb = new BaseHome(config); + Path startIni = hb.getPath("start.ini"); + + String ref = hb.toShortForm(startIni); + Assert.assertThat("Reference",ref,startsWith("${jetty.home}")); + + String contents = IO.readToString(startIni.toFile()); + Assert.assertThat("Contents",contents,containsString("Home Ini")); + } + + @Test + public void testGetPaths_OnlyHome() throws IOException + { + File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); + + ConfigSources config = new ConfigSources(); + config.add(new JettyHomeConfigSource(homeDir.toPath())); + + BaseHome hb = new BaseHome(config); + List paths = hb.getPaths("start.d/*"); + + List expected = new ArrayList<>(); + expected.add("${jetty.home}/start.d/jmx.ini"); + expected.add("${jetty.home}/start.d/jndi.ini"); + expected.add("${jetty.home}/start.d/jsp.ini"); + expected.add("${jetty.home}/start.d/logging.ini"); + expected.add("${jetty.home}/start.d/ssl.ini"); + FSTest.toOsSeparators(expected); + + assertPathList(hb,"Paths found",expected,paths); + } + + @Test + public void testGetPaths_OnlyHome_InisOnly() throws IOException + { + File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); + + ConfigSources config = new ConfigSources(); + config.add(new JettyHomeConfigSource(homeDir.toPath())); + + BaseHome hb = new BaseHome(config); + List paths = hb.getPaths("start.d/*.ini"); + + List expected = new ArrayList<>(); + expected.add("${jetty.home}/start.d/jmx.ini"); + expected.add("${jetty.home}/start.d/jndi.ini"); + expected.add("${jetty.home}/start.d/jsp.ini"); + expected.add("${jetty.home}/start.d/logging.ini"); + expected.add("${jetty.home}/start.d/ssl.ini"); + FSTest.toOsSeparators(expected); + + assertPathList(hb,"Paths found",expected,paths); + } + + @Test + public void testGetPaths_Both() throws IOException + { + File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); + File baseDir = MavenTestingUtils.getTestResourceDir("hb.1/base"); + + ConfigSources config = new ConfigSources(); + config.add(new JettyBaseConfigSource(baseDir.toPath())); + config.add(new JettyHomeConfigSource(homeDir.toPath())); + + BaseHome hb = new BaseHome(config); + List paths = hb.getPaths("start.d/*.ini"); + + List expected = new ArrayList<>(); + expected.add("${jetty.base}/start.d/jmx.ini"); + expected.add("${jetty.home}/start.d/jndi.ini"); + expected.add("${jetty.home}/start.d/jsp.ini"); + expected.add("${jetty.base}/start.d/logging.ini"); + expected.add("${jetty.home}/start.d/ssl.ini"); + expected.add("${jetty.base}/start.d/myapp.ini"); + FSTest.toOsSeparators(expected); + + assertPathList(hb,"Paths found",expected,paths); + } + + @Test + public void testDefault() throws IOException + { + BaseHome bh = new BaseHome(); + Assert.assertThat("Home",bh.getHome(),notNullValue()); + Assert.assertThat("Base",bh.getBase(),notNullValue()); + } + + @Test + public void testGetPath_Both() throws IOException + { + File homeDir = MavenTestingUtils.getTestResourceDir("hb.1/home"); + File baseDir = MavenTestingUtils.getTestResourceDir("hb.1/base"); + + ConfigSources config = new ConfigSources(); + config.add(new JettyBaseConfigSource(baseDir.toPath())); + config.add(new JettyHomeConfigSource(homeDir.toPath())); + + BaseHome hb = new BaseHome(config); + Path startIni = hb.getPath("start.ini"); + + String ref = hb.toShortForm(startIni); + Assert.assertThat("Reference",ref,startsWith("${jetty.base}")); + + String contents = IO.readToString(startIni.toFile()); + Assert.assertThat("Contents",contents,containsString("Base Ini")); + } +} diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java index 70b4da00e95..8a1cd189e57 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java @@ -1,271 +1,272 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.start; - -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.eclipse.jetty.start.Props.Prop; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.eclipse.jetty.toolchain.test.PathAssert; -import org.hamcrest.Matchers; -import org.junit.Assert; - -public class ConfigurationAssert -{ - /** - * Given a provided StartArgs, assert that the configuration it has determined is valid based on values in a assert text file. - * - * @param baseHome the BaseHome used. Access it via {@link Main#getBaseHome()} - * @param args the StartArgs that has been processed via {@link Main#processCommandLine(String[])} - * @param filename the filename of the assertion values - * @throws FileNotFoundException if unable to find the configuration - * @throws IOException if unable to process the configuration - */ - public static void assertConfiguration(BaseHome baseHome, StartArgs args, String filename) throws FileNotFoundException, IOException - { - assertConfiguration(baseHome, args, null, MavenTestingUtils.getTestResourceFile(filename)); - } - - /** - * Given a provided StartArgs, assert that the configuration it has determined is valid based on values in a assert text file. - * - * @param baseHome the BaseHome used. Access it via {@link Main#getBaseHome()} - * @param args the StartArgs that has been processed via {@link Main#processCommandLine(String[])} - * @param output the captured output that you want to assert against - * @param filename the filename of the assertion values - * @throws FileNotFoundException if unable to find the configuration - * @throws IOException if unable to process the configuration - */ - public static void assertConfiguration(BaseHome baseHome, StartArgs args, String output, String filename) throws FileNotFoundException, IOException - { - assertConfiguration(baseHome, args, output, MavenTestingUtils.getTestResourceFile(filename)); - } - - /** - * Given a provided StartArgs, assert that the configuration it has determined is valid based on values in a assert text file. - * - * @param baseHome the BaseHome used. Access it via {@link Main#getBaseHome()} - * @param args the StartArgs that has been processed via {@link Main#processCommandLine(String[])} - * @param file the file of the assertion values - * @throws FileNotFoundException if unable to find the configuration - * @throws IOException if unable to process the configuration - */ - public static void assertConfiguration(BaseHome baseHome, StartArgs args, String output, File file) throws FileNotFoundException, IOException - { - if(output != null) - { - System.err.println(output); - } - Path testResourcesDir = MavenTestingUtils.getTestResourcesDir().toPath().toRealPath(); - TextFile textFile = new TextFile(file.toPath()); - - // Validate XMLs (order is important) - List expectedXmls = new ArrayList<>(); - for (String line : textFile) - { - if (line.startsWith("XML|")) - { - expectedXmls.add(FS.separators(getValue(line))); - } - } - List actualXmls = new ArrayList<>(); - for (Path xml : args.getXmlFiles()) - { - actualXmls.add(shorten(baseHome, xml, testResourcesDir)); - } - assertOrdered("XML Resolution Order", expectedXmls, actualXmls); - - // Validate LIBs (order is not important) - List expectedLibs = new ArrayList<>(); - for (String line : textFile) - { - if (line.startsWith("LIB|")) - { - expectedLibs.add(FS.separators(getValue(line))); - } - } - List actualLibs = new ArrayList<>(); - for (File path : args.getClasspath()) - { - actualLibs.add(shorten(baseHome, path.toPath(), testResourcesDir)); - } - assertContainsUnordered("Libs", expectedLibs, actualLibs); - - // Validate PROPERTIES (order is not important) - Set expectedProperties = new HashSet<>(); - for (String line : textFile) - { - if (line.startsWith("PROP|") || line.startsWith("SYS|")) - { - expectedProperties.add(getValue(line)); - } - } - List actualProperties = new ArrayList<>(); - for (Prop prop : args.getProperties()) - { - String name = prop.key; - if ("jetty.home".equals(name) || - "jetty.base".equals(name) || - "jetty.home.uri".equals(name) || - "jetty.base.uri".equals(name) || - "user.dir".equals(name) || - prop.origin.equals(Props.ORIGIN_SYSPROP) || - name.startsWith("java.")) - { - // strip these out from assertion, to make assertions easier. - continue; - } - actualProperties.add(prop.key + "=" + args.getProperties().expand(prop.value)); - } - assertContainsUnordered("Properties", expectedProperties, actualProperties); - - // Validate PROPERTIES (order is not important) - for (String line : textFile) - { - if (line.startsWith("SYS|")) - { - String[] expected = getValue(line).split("=",2); - String actual = System.getProperty(expected[0]); - assertThat("System property "+expected[0],actual,Matchers.equalTo(expected[1])); - } - } - - // Validate Downloads - List expectedDownloads = new ArrayList<>(); - for (String line : textFile) - { - if (line.startsWith("DOWNLOAD|")) - { - expectedDownloads.add(getValue(line)); - } - } - List actualDownloads = new ArrayList<>(); - for (FileArg darg : args.getFiles()) - { - if (darg.uri != null) - { - actualDownloads.add(String.format("%s|%s", darg.uri, darg.location)); - } - } - assertContainsUnordered("Downloads", expectedDownloads, actualDownloads); - - // File / Path Existence Checks - streamOf(textFile, "EXISTS").forEach(f -> - { - Path path = baseHome.getPath(f); - if (f.endsWith("/")) - { - PathAssert.assertDirExists("Required Directory", path); - } - else - { - PathAssert.assertFileExists("Required File", path); - } - }); - - // Output Validation - streamOf(textFile, "OUTPUT").forEach(regex -> - { - Pattern pat = Pattern.compile(regex); - Matcher mat = pat.matcher(output); - assertTrue("Output [\n" + output + "]\nContains Regex Match: " + pat.pattern(), mat.find()); - }); - } - - private static String shorten(BaseHome baseHome, Path path, Path testResourcesDir) - { - String value = baseHome.toShortForm(path); - if (value.startsWith("${")) - { - return value; - } - - if (path.startsWith(testResourcesDir)) - { - int len = testResourcesDir.toString().length(); - value = "${maven-test-resources}" + value.substring(len); - } - return value; - } - - public static void assertContainsUnordered(String msg, Collection expectedSet, Collection actualSet) - { - try - { - Assert.assertEquals(msg, expectedSet.size(), actualSet.size()); - if (!expectedSet.isEmpty()) - assertThat(msg, actualSet, Matchers.containsInAnyOrder(expectedSet.toArray())); - } - catch (AssertionError e) - { - System.err.println("Expected: " + expectedSet.stream().sorted().collect(Collectors.toList())); - System.err.println("Actual : " + actualSet.stream().sorted().collect(Collectors.toList())); - throw e; - } - - } - - public static void assertOrdered(String msg, List expectedList, List actualList) - { - try - { - Assert.assertEquals(msg, expectedList.size(), actualList.size()); - if (!expectedList.isEmpty()) - assertThat(msg, actualList, Matchers.contains(expectedList.toArray())); - } - catch (AssertionError e) - { - System.err.println("Expected: " + expectedList); - System.err.println("Actual : " + actualList); - throw e; - } - } - - private static Stream streamOf(TextFile textFile, String key) - { - return textFile.stream() - .filter(s -> s.startsWith(key + "|")).map(f -> getValue(f)); - } - - private static String getValue(String arg) - { - int idx = arg.indexOf('|'); - assertThat("Expecting '|' sign in [" + arg + "]", idx, greaterThanOrEqualTo(0)); - String value = arg.substring(idx + 1).trim(); - assertThat("Expecting Value after '|' in [" + arg + "]", value.length(), greaterThan(0)); - return value; - } -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.start; + +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.eclipse.jetty.start.Props.Prop; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; +import org.eclipse.jetty.toolchain.test.PathAssert; +import org.hamcrest.Matchers; +import org.junit.Assert; + +public class ConfigurationAssert +{ + /** + * Given a provided StartArgs, assert that the configuration it has determined is valid based on values in a assert text file. + * + * @param baseHome the BaseHome used. Access it via {@link Main#getBaseHome()} + * @param args the StartArgs that has been processed via {@link Main#processCommandLine(String[])} + * @param filename the filename of the assertion values + * @throws FileNotFoundException if unable to find the configuration + * @throws IOException if unable to process the configuration + */ + public static void assertConfiguration(BaseHome baseHome, StartArgs args, String filename) throws FileNotFoundException, IOException + { + assertConfiguration(baseHome, args, null, MavenTestingUtils.getTestResourceFile(filename)); + } + + /** + * Given a provided StartArgs, assert that the configuration it has determined is valid based on values in a assert text file. + * + * @param baseHome the BaseHome used. Access it via {@link Main#getBaseHome()} + * @param args the StartArgs that has been processed via {@link Main#processCommandLine(String[])} + * @param output the captured output that you want to assert against + * @param filename the filename of the assertion values + * @throws FileNotFoundException if unable to find the configuration + * @throws IOException if unable to process the configuration + */ + public static void assertConfiguration(BaseHome baseHome, StartArgs args, String output, String filename) throws FileNotFoundException, IOException + { + assertConfiguration(baseHome, args, output, MavenTestingUtils.getTestResourceFile(filename)); + } + + /** + * Given a provided StartArgs, assert that the configuration it has determined is valid based on values in a assert text file. + * + * @param baseHome the BaseHome used. Access it via {@link Main#getBaseHome()} + * @param args the StartArgs that has been processed via {@link Main#processCommandLine(String[])} + * @param file the file of the assertion values + * @throws FileNotFoundException if unable to find the configuration + * @throws IOException if unable to process the configuration + */ + public static void assertConfiguration(BaseHome baseHome, StartArgs args, String output, File file) throws FileNotFoundException, IOException + { + if(output != null) + { + System.err.println(output); + } + Path testResourcesDir = MavenTestingUtils.getTestResourcesDir().toPath().toRealPath(); + TextFile textFile = new TextFile(file.toPath()); + + // Validate XMLs (order is important) + List expectedXmls = new ArrayList<>(); + for (String line : textFile) + { + if (line.startsWith("XML|")) + { + expectedXmls.add(FS.separators(getValue(line))); + } + } + List actualXmls = new ArrayList<>(); + for (Path xml : args.getXmlFiles()) + { + actualXmls.add(shorten(baseHome, xml, testResourcesDir)); + } + assertOrdered("XML Resolution Order", expectedXmls, actualXmls); + + // Validate LIBs (order is not important) + List expectedLibs = new ArrayList<>(); + for (String line : textFile) + { + if (line.startsWith("LIB|")) + { + expectedLibs.add(FS.separators(getValue(line))); + } + } + List actualLibs = new ArrayList<>(); + for (File path : args.getClasspath()) + { + actualLibs.add(shorten(baseHome, path.toPath(), testResourcesDir)); + } + assertContainsUnordered("Libs", expectedLibs, actualLibs); + + // Validate PROPERTIES (order is not important) + Set expectedProperties = new HashSet<>(); + for (String line : textFile) + { + if (line.startsWith("PROP|") || line.startsWith("SYS|")) + { + expectedProperties.add(getValue(line)); + } + } + List actualProperties = new ArrayList<>(); + for (Prop prop : args.getProperties()) + { + String name = prop.key; + if ("jetty.home".equals(name) || + "jetty.base".equals(name) || + "jetty.home.uri".equals(name) || + "jetty.base.uri".equals(name) || + "user.dir".equals(name) || + prop.origin.equals(Props.ORIGIN_SYSPROP) || + name.startsWith("java.")) + { + // strip these out from assertion, to make assertions easier. + continue; + } + actualProperties.add(prop.key + "=" + args.getProperties().expand(prop.value)); + } + assertContainsUnordered("Properties", expectedProperties, actualProperties); + + // Validate PROPERTIES (order is not important) + for (String line : textFile) + { + if (line.startsWith("SYS|")) + { + String[] expected = getValue(line).split("=",2); + String actual = System.getProperty(expected[0]); + assertThat("System property "+expected[0],actual,Matchers.equalTo(expected[1])); + } + } + + // Validate Downloads + List expectedDownloads = new ArrayList<>(); + for (String line : textFile) + { + if (line.startsWith("DOWNLOAD|")) + { + expectedDownloads.add(getValue(line)); + } + } + List actualDownloads = new ArrayList<>(); + for (FileArg darg : args.getFiles()) + { + if (darg.uri != null) + { + actualDownloads.add(String.format("%s|%s", darg.uri, darg.location)); + } + } + assertContainsUnordered("Downloads", expectedDownloads, actualDownloads); + + // File / Path Existence Checks + streamOf(textFile, "EXISTS").forEach(f -> + { + Path path = baseHome.getPath(f); + if (f.endsWith("/")) + { + PathAssert.assertDirExists("Required Directory", path); + } + else + { + PathAssert.assertFileExists("Required File", path); + } + }); + + // Output Validation + streamOf(textFile, "OUTPUT").forEach(regex -> + { + Pattern pat = Pattern.compile(regex); + Matcher mat = pat.matcher(output); + assertTrue("Output [\n" + output + "]\nContains Regex Match: " + pat.pattern(), mat.find()); + }); + } + + private static String shorten(BaseHome baseHome, Path path, Path testResourcesDir) + { + String value = baseHome.toShortForm(path); + if (value.startsWith("${")) + { + return value; + } + + if (path.startsWith(testResourcesDir)) + { + int len = testResourcesDir.toString().length(); + value = "${maven-test-resources}" + value.substring(len); + } + return value; + } + + public static void assertContainsUnordered(String msg, Collection expectedSet, Collection actualSet) + { + try + { + Assert.assertEquals(msg, expectedSet.size(), actualSet.size()); + if (!expectedSet.isEmpty()) + assertThat(msg, actualSet, Matchers.containsInAnyOrder(expectedSet.toArray())); + } + catch (AssertionError e) + { + System.err.println("Expected: " + expectedSet.stream().sorted().collect(Collectors.toList())); + System.err.println("Actual : " + actualSet.stream().sorted().collect(Collectors.toList())); + throw e; + } + + } + + @SuppressWarnings("Duplicates") + public static void assertOrdered(String msg, List expectedList, List actualList) + { + try + { + Assert.assertEquals(msg, expectedList.size(), actualList.size()); + if (!expectedList.isEmpty()) + assertThat(msg, actualList, Matchers.contains(expectedList.toArray())); + } + catch (AssertionError e) + { + System.err.println("Expected: " + expectedList); + System.err.println("Actual : " + actualList); + throw e; + } + } + + private static Stream streamOf(TextFile textFile, String key) + { + return textFile.stream() + .filter(s -> s.startsWith(key + "|")).map(f -> getValue(f)); + } + + private static String getValue(String arg) + { + int idx = arg.indexOf('|'); + assertThat("Expecting '|' sign in [" + arg + "]", idx, greaterThanOrEqualTo(0)); + String value = arg.substring(idx + 1).trim(); + assertThat("Expecting Value after '|' in [" + arg + "]", value.length(), greaterThan(0)); + return value; + } +} diff --git a/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_131.mod b/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_131.mod index 4eb78ef5fb2..eb50f520252 100644 --- a/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_131.mod +++ b/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_131.mod @@ -1,6 +1,3 @@ -[name] -alpn-boot - [files] http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.11.v20170118/alpn-boot-8.1.11.v20170118.jar|lib/alpn/alpn-boot-8.1.11.v20170118.jar diff --git a/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_144.mod b/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_144.mod index 4eb78ef5fb2..eb50f520252 100644 --- a/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_144.mod +++ b/jetty-start/src/test/resources/dist-home/modules/alpn-impl/alpn-1.8.0_144.mod @@ -1,6 +1,3 @@ -[name] -alpn-boot - [files] http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/8.1.11.v20170118/alpn-boot-8.1.11.v20170118.jar|lib/alpn/alpn-boot-8.1.11.v20170118.jar diff --git a/jetty-util-ajax/pom.xml b/jetty-util-ajax/pom.xml index 0f155a2773d..8b0b7c19fdd 100644 --- a/jetty-util-ajax/pom.xml +++ b/jetty-util-ajax/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-util-ajax @@ -14,54 +14,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.servlet.*;version="[2.6.0,3.2)",org.slf4j;version="[1.5,2.0)";resolution:=optional,org.slf4j.impl;version="[1.5,2.0)";resolution:=optional,* - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - org.codehaus.mojo findbugs-maven-plugin diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 174e2d33cc3..bf31ba5db57 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-util @@ -14,52 +14,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.servlet.*;version="[2.6.0,3.2)",org.slf4j;version="[1.6,2.0)";resolution:=optional,org.slf4j.impl;version="[1.6,2.0)";resolution:=optional,* - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - org.codehaus.mojo findbugs-maven-plugin @@ -68,6 +22,19 @@ + + + + org.apache.maven.plugins + maven-surefire-plugin + + + ${settings.localRepository} + + + + + diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java b/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java index f90be361b39..98b3ef261ac 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/RolloverFileOutputStream.java @@ -24,7 +24,9 @@ import java.io.FilterOutputStream; import java.io.IOException; import java.io.OutputStream; import java.text.SimpleDateFormat; -import java.util.Calendar; +import java.time.ZonedDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Date; import java.util.Locale; import java.util.TimeZone; import java.util.Timer; @@ -50,13 +52,12 @@ public class RolloverFileOutputStream extends FilterOutputStream final static String ROLLOVER_FILE_DATE_FORMAT = "yyyy_MM_dd"; final static String ROLLOVER_FILE_BACKUP_FORMAT = "HHmmssSSS"; final static int ROLLOVER_FILE_RETAIN_DAYS = 31; - + private RollTask _rollTask; private SimpleDateFormat _fileBackupFormat; private SimpleDateFormat _fileDateFormat; - - private final TimeZone _timeZone; - private final String _filename; + + private String _filename; private File _file; private boolean _append; private int _retainDays; @@ -117,7 +118,7 @@ public class RolloverFileOutputStream extends FilterOutputStream TimeZone zone) throws IOException { - this(filename,append,retainDays,zone,null,null); + this(filename,append,retainDays,zone,null,null,ZonedDateTime.now(zone.toZoneId())); } /* ------------------------------------------------------------ */ @@ -139,21 +140,20 @@ public class RolloverFileOutputStream extends FilterOutputStream String backupFormat) throws IOException { - this(filename,append,retainDays,zone,dateFormat,backupFormat,Calendar.getInstance(zone)); + this(filename,append,retainDays,zone,dateFormat,backupFormat,ZonedDateTime.now(zone.toZoneId())); } + RolloverFileOutputStream(String filename, boolean append, int retainDays, TimeZone zone, String dateFormat, String backupFormat, - Calendar now) + ZonedDateTime now) throws IOException { super(null); - - _timeZone = zone; if (dateFormat==null) dateFormat=ROLLOVER_FILE_DATE_FORMAT; @@ -174,9 +174,8 @@ public class RolloverFileOutputStream extends FilterOutputStream } if (filename==null) throw new IllegalArgumentException("Invalid filename"); - - File testfile = new File(filename); - _filename=testfile.getCanonicalPath(); + + _filename=filename; _append=append; _retainDays=retainDays; @@ -186,7 +185,7 @@ public class RolloverFileOutputStream extends FilterOutputStream __rollover=new Timer(RolloverFileOutputStream.class.getName(),true); // Calculate Today's Midnight, based on Configured TimeZone (will be in past, even if by a few milliseconds) - setFile(now); + setFile(now); // This will schedule the rollover event to the next midnight scheduleNextRollover(now); } @@ -196,32 +195,23 @@ public class RolloverFileOutputStream extends FilterOutputStream /** * Get the "start of day" for the provided DateTime at the zone specified. * - * @param cal the date time to calculate from + * @param now the date time to calculate from * @return start of the day of the date provided */ - public static Calendar toMidnight(Calendar cal) + public static ZonedDateTime toMidnight(ZonedDateTime now) { - Calendar ret = Calendar.getInstance(); - ret.setTimeZone(cal.getTimeZone()); - ret.setTime(cal.getTime()); - ret.set(Calendar.HOUR_OF_DAY, 0); - ret.set(Calendar.MINUTE, 0); - ret.set(Calendar.SECOND, 0); - ret.set(Calendar.MILLISECOND, 0); - // next days midnight - ret.add(Calendar.DAY_OF_MONTH, 1); - return ret; + return now.toLocalDate().atStartOfDay(now.getZone()).plus(1, ChronoUnit.DAYS); } /* ------------------------------------------------------------ */ - private void scheduleNextRollover(Calendar now) + private void scheduleNextRollover(ZonedDateTime now) { _rollTask = new RollTask(); - // Establish next day's midnight of provided calendar - Calendar midnight = toMidnight(now); + // Get tomorrow's midnight based on Configured TimeZone + ZonedDateTime midnight = toMidnight(now); // Schedule next rollover event to occur, based on local machine's Unix Epoch milliseconds - long delay = midnight.getTimeInMillis() - now.getTimeInMillis(); + long delay = midnight.toInstant().toEpochMilli() - now.toInstant().toEpochMilli(); __rollover.schedule(_rollTask,delay); } @@ -246,11 +236,13 @@ public class RolloverFileOutputStream extends FilterOutputStream } /* ------------------------------------------------------------ */ - synchronized void setFile(Calendar now) + synchronized void setFile(ZonedDateTime now) throws IOException { // Check directory - File file=new File(_filename); + File file = new File(_filename); + _filename=file.getCanonicalPath(); + file=new File(_filename); File dir= new File(file.getParent()); if (!dir.isDirectory() || !dir.canWrite()) throw new IOException("Cannot write log directory "+dir); @@ -262,7 +254,7 @@ public class RolloverFileOutputStream extends FilterOutputStream { file=new File(dir, filename.substring(0,i)+ - _fileDateFormat.format(now.getTime()) + + _fileDateFormat.format(new Date(now.toInstant().toEpochMilli()))+ filename.substring(i+YYYY_MM_DD.length())); } @@ -275,7 +267,7 @@ public class RolloverFileOutputStream extends FilterOutputStream // Yep _file=file; if (!_append && file.exists()) - file.renameTo(new File(file.toString()+"."+_fileBackupFormat.format(now.getTime()))); + file.renameTo(new File(file.toString()+"."+_fileBackupFormat.format(new Date(now.toInstant().toEpochMilli())))); OutputStream oldOut=out; out=new FileOutputStream(file.toString(),_append); if (oldOut!=null) @@ -285,13 +277,12 @@ public class RolloverFileOutputStream extends FilterOutputStream } /* ------------------------------------------------------------ */ - void removeOldFiles(Calendar now) + void removeOldFiles(ZonedDateTime now) { if (_retainDays>0) { // Establish expiration time, based on configured TimeZone - now.add(Calendar.DAY_OF_MONTH, (-1)*_retainDays); - long expired = now.getTimeInMillis(); + long expired = now.minus(_retainDays, ChronoUnit.DAYS).toInstant().toEpochMilli(); File file= new File(_filename); File dir = new File(file.getParent()); @@ -365,7 +356,7 @@ public class RolloverFileOutputStream extends FilterOutputStream { synchronized(RolloverFileOutputStream.class) { - Calendar now = Calendar.getInstance(_timeZone); + ZonedDateTime now = ZonedDateTime.now(_fileDateFormat.getTimeZone().toZoneId()); RolloverFileOutputStream.this.setFile(now); RolloverFileOutputStream.this.scheduleNextRollover(now); RolloverFileOutputStream.this.removeOldFiles(now); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java b/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java index bb7b504b9aa..d839ad50667 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java @@ -29,7 +29,6 @@ import java.util.concurrent.locks.ReentrantLock; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.util.thread.Invocable.InvocationType; /** * Provides a reusable {@link Callback} that can block the thread @@ -168,6 +167,7 @@ public class SharedBlockingCallback } else { + cause.printStackTrace(System.err); throw new IllegalStateException(_state); } } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java index 2b6aeaa5493..56947e9e3fb 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java @@ -26,70 +26,87 @@ import java.io.FileReader; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.attribute.FileTime; -import java.text.ParseException; -import java.text.SimpleDateFormat; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.time.temporal.TemporalAccessor; import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; import java.util.TimeZone; import java.util.concurrent.TimeUnit; import org.eclipse.jetty.toolchain.test.FS; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.hamcrest.Matchers; -import org.junit.Rule; import org.junit.Test; public class RolloverFileOutputStreamTest { - @Rule - public TestingDir testingDir = new TestingDir(); - - private static TimeZone toZoneId(String timezoneId) + private static ZoneId toZoneId(String timezoneId) { - TimeZone zone = TimeZone.getTimeZone(timezoneId); - // System.err.printf("toZoneId('%s'): displayName=%s, id=%s%n", timezoneId, zone.getDisplayName(), zone.getID()); + ZoneId zone = TimeZone.getTimeZone(timezoneId).toZoneId(); + // System.out.printf(".toZoneId(\"%s\") = [id=%s,normalized=%s]%n", timezoneId, zone.getId(), zone.normalized()); return zone; } - private static Calendar toDateTime(String timendate, TimeZone zone) throws ParseException + private static ZonedDateTime toDateTime(String timendate, ZoneId zone) { - SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd-hh:mm:ss.S a z"); - formatter.setTimeZone(zone); - Date parsed = formatter.parse(timendate); - Calendar cal = Calendar.getInstance(zone); - cal.setTime(parsed); - return cal; + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd-hh:mm:ss.S a z") + .withZone(zone); + return ZonedDateTime.parse(timendate, formatter); } - private static String toString(Calendar date) + private static String toString(TemporalAccessor date) { - SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd-hh:mm:ss.S a z"); - formatter.setTimeZone(date.getTimeZone()); - return formatter.format(date.getTime()); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd-hh:mm:ss.S a z"); + return formatter.format(date); } - private void assertSequence(Calendar midnight, Object[][] expected) + private void assertSequence(ZonedDateTime midnight, Object[][] expected) { - Calendar nextEvent = midnight; + ZonedDateTime nextEvent = midnight; for (int i = 0; i < expected.length; i++) { - long lastMs = nextEvent.getTimeInMillis(); - nextEvent = RolloverFileOutputStream.toMidnight(nextEvent); + long currentMillis = nextEvent.toInstant().toEpochMilli(); + nextEvent = nextEvent.toLocalDate().plus(1, ChronoUnit.DAYS).atStartOfDay(nextEvent.getZone()); assertThat("Next Event", toString(nextEvent), is(expected[i][0])); - long duration = (nextEvent.getTimeInMillis() - lastMs); + long duration = (nextEvent.toInstant().toEpochMilli() - currentMillis); assertThat("Duration to next event", duration, is((long) expected[i][1])); } } + /** + * https://github.com/eclipse/jetty.project/issues/1507 + */ @Test - public void testMidnightRolloverCalc_PST_DST_Start() throws ParseException + public void testMidnightRolloverCalc_PDT_Issue1507() { - TimeZone zone = toZoneId("PST"); - Calendar initialDate = toDateTime("2016.03.10-01:23:45.0 PM PST", zone); + ZoneId zone = toZoneId("PST"); + ZonedDateTime initialDate = toDateTime("2017.04.26-08:00:00.0 PM PDT", zone); - Calendar midnight = RolloverFileOutputStream.toMidnight(initialDate); + ZonedDateTime midnight = RolloverFileOutputStream.toMidnight(initialDate); + assertThat("Midnight", toString(midnight), is("2017.04.27-12:00:00.0 AM PDT")); + + Object expected[][] = { + {"2017.04.27-12:00:00.0 AM PDT", 14_400_000L}, + {"2017.04.28-12:00:00.0 AM PDT", 86_400_000L}, + {"2017.04.29-12:00:00.0 AM PDT", 86_400_000L}, + {"2017.04.30-12:00:00.0 AM PDT", 86_400_000L}, + {"2017.05.01-12:00:00.0 AM PDT", 86_400_000L}, + {"2017.05.02-12:00:00.0 AM PDT", 86_400_000L}, + }; + + assertSequence(initialDate, expected); + } + + @Test + public void testMidnightRolloverCalc_PST_DST_Start() + { + ZoneId zone = toZoneId("PST"); + ZonedDateTime initialDate = toDateTime("2016.03.10-01:23:45.0 PM PST", zone); + + ZonedDateTime midnight = RolloverFileOutputStream.toMidnight(initialDate); assertThat("Midnight", toString(midnight), is("2016.03.11-12:00:00.0 AM PST")); Object expected[][] = { @@ -104,12 +121,12 @@ public class RolloverFileOutputStreamTest } @Test - public void testMidnightRolloverCalc_PST_DST_End() throws ParseException + public void testMidnightRolloverCalc_PST_DST_End() { - TimeZone zone = toZoneId("PST"); - Calendar initialDate = toDateTime("2016.11.03-11:22:33.0 AM PDT", zone); + ZoneId zone = toZoneId("PST"); + ZonedDateTime initialDate = toDateTime("2016.11.03-11:22:33.0 AM PDT", zone); - Calendar midnight = RolloverFileOutputStream.toMidnight(initialDate); + ZonedDateTime midnight = RolloverFileOutputStream.toMidnight(initialDate); assertThat("Midnight", toString(midnight), is("2016.11.04-12:00:00.0 AM PDT")); Object expected[][] = { @@ -124,12 +141,12 @@ public class RolloverFileOutputStreamTest } @Test - public void testMidnightRolloverCalc_Sydney_DST_Start() throws ParseException + public void testMidnightRolloverCalc_Sydney_DST_Start() { - TimeZone zone = toZoneId("Australia/Sydney"); - Calendar initialDate = toDateTime("2016.09.30-01:23:45.0 PM AEST", zone); + ZoneId zone = toZoneId("Australia/Sydney"); + ZonedDateTime initialDate = toDateTime("2016.09.31-01:23:45.0 PM AEST", zone); - Calendar midnight = RolloverFileOutputStream.toMidnight(initialDate); + ZonedDateTime midnight = RolloverFileOutputStream.toMidnight(initialDate); assertThat("Midnight", toString(midnight), is("2016.10.01-12:00:00.0 AM AEST")); Object expected[][] = { @@ -144,12 +161,12 @@ public class RolloverFileOutputStreamTest } @Test - public void testMidnightRolloverCalc_Sydney_DST_End() throws ParseException + public void testMidnightRolloverCalc_Sydney_DST_End() { - TimeZone zone = toZoneId("Australia/Sydney"); - Calendar initialDate = toDateTime("2016.04.01-11:22:33.0 AM AEDT", zone); + ZoneId zone = toZoneId("Australia/Sydney"); + ZonedDateTime initialDate = toDateTime("2016.04.01-11:22:33.0 AM AEDT", zone); - Calendar midnight = RolloverFileOutputStream.toMidnight(initialDate); + ZonedDateTime midnight = RolloverFileOutputStream.toMidnight(initialDate); assertThat("Midnight", toString(midnight), is("2016.04.02-12:00:00.0 AM AEDT")); Object expected[][] = { @@ -169,23 +186,23 @@ public class RolloverFileOutputStreamTest File testDir = MavenTestingUtils.getTargetTestingDir(RolloverFileOutputStreamTest.class.getName() + "_testFileHandling"); Path testPath = testDir.toPath(); FS.ensureEmpty(testDir); - - TimeZone zone = toZoneId("Australia/Sydney"); - Calendar now = toDateTime("2016.04.10-08:30:12.3 AM AEST", zone); + + ZoneId zone = toZoneId("Australia/Sydney"); + ZonedDateTime now = toDateTime("2016.04.10-08:30:12.3 AM AEDT", zone); File template = new File(testDir,"test-rofos-yyyy_mm_dd.log"); try (RolloverFileOutputStream rofos = - new RolloverFileOutputStream(template.getAbsolutePath(),false,3,zone,null,null,now)) + new RolloverFileOutputStream(template.getAbsolutePath(),false,3,TimeZone.getTimeZone(zone),null,null,now)) { rofos.write("TICK".getBytes()); rofos.flush(); } - now.add(Calendar.MINUTE, 5); + now = now.plus(5,ChronoUnit.MINUTES); try (RolloverFileOutputStream rofos = - new RolloverFileOutputStream(template.getAbsolutePath(),false,3,zone,null,null,now)) + new RolloverFileOutputStream(template.getAbsolutePath(),false,3,TimeZone.getTimeZone(zone),null,null,now)) { rofos.write("TOCK".getBytes()); rofos.flush(); @@ -200,37 +217,32 @@ public class RolloverFileOutputStreamTest assertThat(Arrays.asList(ls),Matchers.containsInAnyOrder(backup,"test-rofos-2016_04_10.log")); - Files.setLastModifiedTime(testPath.resolve(backup),FileTime.fromMillis(now.getTimeInMillis())); - Files.setLastModifiedTime(testPath.resolve("test-rofos-2016_04_10.log"),FileTime.fromMillis(now.getTimeInMillis())); + Files.setLastModifiedTime(testPath.resolve(backup),FileTime.from(now.toInstant())); + Files.setLastModifiedTime(testPath.resolve("test-rofos-2016_04_10.log"),FileTime.from(now.toInstant())); - // Copy calendar (don't want to change "now") - Calendar time = Calendar.getInstance(); - time.setTimeZone(now.getTimeZone()); - time.setTime(now.getTime()); - time.add(Calendar.DAY_OF_MONTH, -1); - + ZonedDateTime time = now.minus(1,ChronoUnit.DAYS); for (int i=10;i-->5;) { String file = "test-rofos-2016_04_0"+i+".log"; Path path = testPath.resolve(file); FS.touch(path); - Files.setLastModifiedTime(path,FileTime.fromMillis(time.getTimeInMillis())); + Files.setLastModifiedTime(path,FileTime.from(time.toInstant())); if (i%2==0) { file = "test-rofos-2016_04_0"+i+".log.083512300"; path = testPath.resolve(file); FS.touch(path); - Files.setLastModifiedTime(path,FileTime.fromMillis(time.getTimeInMillis())); - time.add(Calendar.DAY_OF_MONTH, -1); + Files.setLastModifiedTime(path,FileTime.from(time.toInstant())); + time = time.minus(1,ChronoUnit.DAYS); } file = "unrelated-"+i; path = testPath.resolve(file); FS.touch(path); - Files.setLastModifiedTime(path,FileTime.fromMillis(time.getTimeInMillis())); - - time.add(Calendar.DAY_OF_MONTH, -1); + Files.setLastModifiedTime(path,FileTime.from(time.toInstant())); + + time = time.minus(1,ChronoUnit.DAYS); } ls = testDir.list(); @@ -242,9 +254,9 @@ public class RolloverFileOutputStreamTest "test-rofos-2016_04_08.log", "test-rofos-2016_04_09.log", "test-rofos-2016_04_10.log", - "test-rofos-2016_04_06.log.083512300", - "test-rofos-2016_04_08.log.083512300", - "test-rofos-2016_04_10.log.083512003", + "test-rofos-2016_04_06.log.083512300", + "test-rofos-2016_04_08.log.083512300", + "test-rofos-2016_04_10.log.083512300", "unrelated-9", "unrelated-8", "unrelated-7", @@ -260,7 +272,7 @@ public class RolloverFileOutputStreamTest "test-rofos-2016_04_09.log", "test-rofos-2016_04_10.log", "test-rofos-2016_04_08.log.083512300", - "test-rofos-2016_04_10.log.083512003", + "test-rofos-2016_04_10.log.083512300", "unrelated-9", "unrelated-8", "unrelated-7", @@ -279,14 +291,14 @@ public class RolloverFileOutputStreamTest { File testDir = MavenTestingUtils.getTargetTestingDir(RolloverFileOutputStreamTest.class.getName() + "_testRollover"); FS.ensureEmpty(testDir); - - TimeZone zone = toZoneId("Australia/Sydney"); - Calendar now = toDateTime("2016.04.10-11:59:58.0 PM AEST", zone); + + ZoneId zone = toZoneId("Australia/Sydney"); + ZonedDateTime now = toDateTime("2016.04.10-11:59:55.0 PM AEDT", zone); File template = new File(testDir,"test-rofos-yyyy_mm_dd.log"); try (RolloverFileOutputStream rofos = - new RolloverFileOutputStream(template.getAbsolutePath(),false,0,zone,null,null,now)) + new RolloverFileOutputStream(template.getAbsolutePath(),false,0,TimeZone.getTimeZone(zone),null,null,now)) { rofos.write("BEFORE".getBytes()); rofos.flush(); @@ -294,7 +306,7 @@ public class RolloverFileOutputStreamTest assertThat(ls.length,is(1)); assertThat(ls[0],is("test-rofos-2016_04_10.log")); - TimeUnit.SECONDS.sleep(5); + TimeUnit.SECONDS.sleep(10); rofos.write("AFTER".getBytes()); ls = testDir.list(); assertThat(ls.length,is(2)); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilCanonicalPathTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilCanonicalPathTest.java index dd260b9d013..f29a394fc0c 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilCanonicalPathTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilCanonicalPathTest.java @@ -1,135 +1,135 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.util; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import java.util.Arrays; -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -@RunWith(Parameterized.class) -public class URIUtilCanonicalPathTest -{ - @Parameterized.Parameters(name = "{0}") - public static List data() - { - String[][] canonical = - { - // Basic examples (no changes expected) - {"/hello.html", "/hello.html"}, - {"/css/main.css", "/css/main.css"}, - {"/", "/"}, - {"", ""}, - {"/aaa/bbb/", "/aaa/bbb/"}, - {"/aaa/bbb", "/aaa/bbb"}, - {"aaa/bbb", "aaa/bbb"}, - {"aaa/", "aaa/"}, - {"aaa", "aaa"}, - {"a", "a"}, - {"a/", "a/"}, - - // Extra slashes - {"/aaa//bbb/", "/aaa//bbb/"}, - {"/aaa//bbb", "/aaa//bbb"}, - {"/aaa///bbb/", "/aaa///bbb/"}, - - // Path traversal with current references "./" - {"/aaa/./bbb/", "/aaa/bbb/"}, - {"/aaa/./bbb", "/aaa/bbb"}, - {"./bbb/", "bbb/"}, - {"./aaa/../bbb/", "bbb/"}, - {"/foo/.", "/foo/"}, - {"./", ""}, - {".", ""}, - {".//", "/"}, - {".///", "//"}, - {"/.", "/"}, - {"//.", "//"}, - {"///.", "///"}, - - // Path traversal directory (but not past root) - {"/aaa/../bbb/", "/bbb/"}, - {"/aaa/../bbb", "/bbb"}, - {"/aaa..bbb/", "/aaa..bbb/"}, - {"/aaa..bbb", "/aaa..bbb"}, - {"/aaa/..bbb/", "/aaa/..bbb/"}, - {"/aaa/..bbb", "/aaa/..bbb"}, - {"/aaa/./../bbb/", "/bbb/"}, - {"/aaa/./../bbb", "/bbb"}, - {"/aaa/bbb/ccc/../../ddd/", "/aaa/ddd/"}, - {"/aaa/bbb/ccc/../../ddd", "/aaa/ddd"}, - {"/foo/../bar//", "/bar//"}, - {"/ctx/../bar/../ctx/all/index.txt", "/ctx/all/index.txt"}, - {"/down/.././index.html", "/index.html"}, - - // Path traversal up past root - {"..", null}, - {"./..", null}, - {"aaa/../..", null}, - {"/foo/bar/../../..", null}, - {"/../foo", null}, - {"a/.", "a/"}, - {"a/..", ""}, - {"a/../..", null}, - {"/foo/../../bar", null}, - - // Query parameter specifics - {"/ctx/dir?/../index.html", "/ctx/index.html"}, - {"/get-files?file=/etc/passwd", "/get-files?file=/etc/passwd"}, - {"/get-files?file=../../../../../passwd", null}, - - // Known windows shell quirks - {"file.txt ", "file.txt "}, // with spaces - {"file.txt...", "file.txt..."}, // extra dots ignored by windows - // BREAKS Jenkins: {"file.txt\u0000", "file.txt\u0000"}, // null terminated is ignored by windows - {"file.txt\r", "file.txt\r"}, // CR terminated is ignored by windows - {"file.txt\n", "file.txt\n"}, // LF terminated is ignored by windows - {"file.txt\"\"\"\"", "file.txt\"\"\"\""}, // extra quotes ignored by windows - {"file.txt<<<>>><", "file.txt<<<>>><"}, // angle brackets at end of path ignored by windows - {"././././././file.txt", "file.txt"}, - - // Oddball requests that look like path traversal, but are not - {"/....", "/...."}, - {"/..../ctx/..../blah/logo.jpg", "/..../ctx/..../blah/logo.jpg"}, - - // paths with encoded segments should remain encoded - // canonicalPath() is not responsible for decoding characters - {"%2e%2e/", "%2e%2e/"}, - }; - return Arrays.asList(canonical); - } - - @Parameterized.Parameter(0) - public String input; - - @Parameterized.Parameter(1) - public String expectedResult; - - @Test - public void testCanonicalPath() - { - assertThat("Canonical", URIUtil.canonicalPath(input), is(expectedResult)); - } - -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.util; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class URIUtilCanonicalPathTest +{ + @Parameterized.Parameters(name = "{0}") + public static List data() + { + String[][] canonical = + { + // Basic examples (no changes expected) + {"/hello.html", "/hello.html"}, + {"/css/main.css", "/css/main.css"}, + {"/", "/"}, + {"", ""}, + {"/aaa/bbb/", "/aaa/bbb/"}, + {"/aaa/bbb", "/aaa/bbb"}, + {"aaa/bbb", "aaa/bbb"}, + {"aaa/", "aaa/"}, + {"aaa", "aaa"}, + {"a", "a"}, + {"a/", "a/"}, + + // Extra slashes + {"/aaa//bbb/", "/aaa//bbb/"}, + {"/aaa//bbb", "/aaa//bbb"}, + {"/aaa///bbb/", "/aaa///bbb/"}, + + // Path traversal with current references "./" + {"/aaa/./bbb/", "/aaa/bbb/"}, + {"/aaa/./bbb", "/aaa/bbb"}, + {"./bbb/", "bbb/"}, + {"./aaa/../bbb/", "bbb/"}, + {"/foo/.", "/foo/"}, + {"./", ""}, + {".", ""}, + {".//", "/"}, + {".///", "//"}, + {"/.", "/"}, + {"//.", "//"}, + {"///.", "///"}, + + // Path traversal directory (but not past root) + {"/aaa/../bbb/", "/bbb/"}, + {"/aaa/../bbb", "/bbb"}, + {"/aaa..bbb/", "/aaa..bbb/"}, + {"/aaa..bbb", "/aaa..bbb"}, + {"/aaa/..bbb/", "/aaa/..bbb/"}, + {"/aaa/..bbb", "/aaa/..bbb"}, + {"/aaa/./../bbb/", "/bbb/"}, + {"/aaa/./../bbb", "/bbb"}, + {"/aaa/bbb/ccc/../../ddd/", "/aaa/ddd/"}, + {"/aaa/bbb/ccc/../../ddd", "/aaa/ddd"}, + {"/foo/../bar//", "/bar//"}, + {"/ctx/../bar/../ctx/all/index.txt", "/ctx/all/index.txt"}, + {"/down/.././index.html", "/index.html"}, + + // Path traversal up past root + {"..", null}, + {"./..", null}, + {"aaa/../..", null}, + {"/foo/bar/../../..", null}, + {"/../foo", null}, + {"a/.", "a/"}, + {"a/..", ""}, + {"a/../..", null}, + {"/foo/../../bar", null}, + + // Query parameter specifics + {"/ctx/dir?/../index.html", "/ctx/index.html"}, + {"/get-files?file=/etc/passwd", "/get-files?file=/etc/passwd"}, + {"/get-files?file=../../../../../passwd", null}, + + // Known windows shell quirks + {"file.txt ", "file.txt "}, // with spaces + {"file.txt...", "file.txt..."}, // extra dots ignored by windows + // BREAKS Jenkins: {"file.txt\u0000", "file.txt\u0000"}, // null terminated is ignored by windows + {"file.txt\r", "file.txt\r"}, // CR terminated is ignored by windows + {"file.txt\n", "file.txt\n"}, // LF terminated is ignored by windows + {"file.txt\"\"\"\"", "file.txt\"\"\"\""}, // extra quotes ignored by windows + {"file.txt<<<>>><", "file.txt<<<>>><"}, // angle brackets at end of path ignored by windows + {"././././././file.txt", "file.txt"}, + + // Oddball requests that look like path traversal, but are not + {"/....", "/...."}, + {"/..../ctx/..../blah/logo.jpg", "/..../ctx/..../blah/logo.jpg"}, + + // paths with encoded segments should remain encoded + // canonicalPath() is not responsible for decoding characters + {"%2e%2e/", "%2e%2e/"}, + }; + return Arrays.asList(canonical); + } + + @Parameterized.Parameter(0) + public String input; + + @Parameterized.Parameter(1) + public String expectedResult; + + @Test + public void testCanonicalPath() + { + assertThat("Canonical", URIUtil.canonicalPath(input), is(expectedResult)); + } + +} diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index 1c3dfe2e58c..e5777924d80 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-webapp @@ -27,54 +27,6 @@ - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - javax.servlet.*;version="[2.6.0,3.2]",* - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - org.codehaus.mojo findbugs-maven-plugin @@ -82,6 +34,17 @@ org.eclipse.jetty.webapp.* + + org.apache.maven.plugins + maven-surefire-plugin + + + org.eclipse.jetty.webapp.WebAppClassLoaderUrlStreamTest + + 1 + false + + diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/URLStreamHandlerUtil.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/URLStreamHandlerUtil.java index aae6de59eed..2e6addb4684 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/URLStreamHandlerUtil.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/URLStreamHandlerUtil.java @@ -1,78 +1,78 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.webapp; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.net.URL; -import java.net.URLStreamHandlerFactory; -import java.util.Arrays; -import java.util.Optional; - -public final class URLStreamHandlerUtil -{ - public static void setFactory(URLStreamHandlerFactory factory) - { - try - { - // First, reset the factory field - Field factoryField = getURLStreamHandlerFactoryField(); - factoryField.setAccessible(true); - factoryField.set(null, null); - - if(factory != null) - { - // Next, set the factory - URL.setURLStreamHandlerFactory(factory); - } - } - catch(Throwable ignore) - { - // ignore.printStackTrace(System.err); - } - } - - public static URLStreamHandlerFactory getFactory() - { - try - { - // First, reset the factory field - Field factoryField = getURLStreamHandlerFactoryField(); - factoryField.setAccessible(true); - return (URLStreamHandlerFactory) factoryField.get(null); - } - catch(Throwable ignore) - { - return null; - } - } - - private static Field getURLStreamHandlerFactoryField() - { - Optional optFactoryField = Arrays.stream(URL.class.getDeclaredFields()) - .filter((f) -> Modifier.isStatic(f.getModifiers()) && - f.getType().equals(URLStreamHandlerFactory.class)) - .findFirst(); - - if(optFactoryField.isPresent()) - return optFactoryField.get(); - - throw new RuntimeException( "Cannot find URLStreamHandlerFactory field in " + URL.class.getName() ); - } -} +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.webapp; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.net.URL; +import java.net.URLStreamHandlerFactory; +import java.util.Arrays; +import java.util.Optional; + +public final class URLStreamHandlerUtil +{ + public static void setFactory(URLStreamHandlerFactory factory) + { + try + { + // First, reset the factory field + Field factoryField = getURLStreamHandlerFactoryField(); + factoryField.setAccessible(true); + factoryField.set(null, null); + + if(factory != null) + { + // Next, set the factory + URL.setURLStreamHandlerFactory(factory); + } + } + catch(Throwable ignore) + { + // ignore.printStackTrace(System.err); + } + } + + public static URLStreamHandlerFactory getFactory() + { + try + { + // First, reset the factory field + Field factoryField = getURLStreamHandlerFactoryField(); + factoryField.setAccessible(true); + return (URLStreamHandlerFactory) factoryField.get(null); + } + catch(Throwable ignore) + { + return null; + } + } + + private static Field getURLStreamHandlerFactoryField() + { + Optional optFactoryField = Arrays.stream(URL.class.getDeclaredFields()) + .filter((f) -> Modifier.isStatic(f.getModifiers()) && + f.getType().equals(URLStreamHandlerFactory.class)) + .findFirst(); + + if(optFactoryField.isPresent()) + return optFactoryField.get(); + + throw new RuntimeException( "Cannot find URLStreamHandlerFactory field in " + URL.class.getName() ); + } +} diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index 7f722aec9a8..35eaeb44849 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jetty-xml @@ -14,30 +14,6 @@ - - org.apache.felix - maven-bundle-plugin - true - - - - manifest - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.codehaus.mojo findbugs-maven-plugin diff --git a/pom.xml b/pom.xml index 9b662be2dce..e53667acd88 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 4.0.0 org.eclipse.jetty jetty-project - 9.3.20-SNAPSHOT + 9.4.7-SNAPSHOT Jetty :: Project The Eclipse Jetty Project pom @@ -861,92 +861,6 @@ - - - - org.apache.maven.plugins - maven-jxr-plugin - - - org.apache.maven.plugins - maven-javadoc-plugin - - 512m - true - true - true - - - - org.apache.maven.plugins - maven-pmd-plugin - - 1.7 - - jetty/pmd_ruleset.xml - - - - - org.codehaus.mojo - findbugs-maven-plugin - - - - - - jetty-ant - jetty-util - jetty-jmx - jetty-io - jetty-http - jetty-http2 - jetty-continuation - jetty-server - jetty-xml - jetty-security - jetty-servlet - jetty-webapp - jetty-fcgi - jetty-websocket - jetty-servlets - jetty-util-ajax - apache-jsp - apache-jstl - jetty-maven-plugin - jetty-jspc-maven-plugin - jetty-deploy - jetty-start - jetty-plus - jetty-annotations - jetty-jndi - jetty-jaas - jetty-cdi - jetty-spring - jetty-client - jetty-proxy - jetty-jaspi - jetty-rewrite - jetty-nosql - jetty-infinispan - jetty-hazelcast - jetty-gcloud - tests - examples - jetty-quickstart - jetty-distribution - jetty-runner - jetty-monitor - jetty-http-spi - jetty-osgi - jetty-alpn - jetty-bom - jetty-documentation - - - - - @@ -957,7 +871,7 @@ javax.websocket javax.websocket-api - 1.0 + 1.1 javax.annotation @@ -1033,7 +947,7 @@ org.eclipse.jetty.toolchain jetty-test-helper - 4.0 + 4.1 org.eclipse.jetty.toolchain @@ -1665,6 +1579,17 @@ https://webtide.com + + + jetty-snapshots + jetty-snapshots + http://oss.sonatype.org/content/repositories/jetty-snapshots + + true + + + + oss.sonatype.org diff --git a/tests/pom.xml b/tests/pom.xml index ea58838cf0e..40115df2764 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -1,27 +1,10 @@ - 4.0.0 org.eclipse.jetty jetty-project - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml org.eclipse.jetty.tests @@ -75,5 +58,6 @@ test-integration test-quickstart test-jmx + test-http-client-transport diff --git a/tests/test-continuation/pom.xml b/tests/test-continuation/pom.xml index 883694e88b0..0cc371b0dc2 100644 --- a/tests/test-continuation/pom.xml +++ b/tests/test-continuation/pom.xml @@ -1,26 +1,9 @@ - org.eclipse.jetty.tests tests-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml 4.0.0 @@ -28,6 +11,9 @@ jar Test :: Continuation Asynchronous API + + ${project.groupId}.continuation + @@ -42,11 +28,11 @@ - org.eclipse.jetty + org.eclipse.jetty jetty-servlet ${project.version} provided - + org.eclipse.jetty jetty-continuation @@ -57,6 +43,6 @@ jetty-test-helper compile - + diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index c6ba1f95946..8910c3f7934 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -1,26 +1,9 @@ - org.eclipse.jetty.tests tests-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 test-integration @@ -31,6 +14,8 @@ ${project.build.directory}/test-wars ${project.build.directory}/test-libs ${project.build.directory}/test-dist + ${project.groupId}.integrations + @@ -116,6 +101,13 @@ ${project.version} pom + + org.eclipse.jetty + jetty-http + ${project.version} + tests + test + org.eclipse.jetty.toolchain jetty-test-helper @@ -123,7 +115,7 @@ org.eclipse.jetty - jetty-jsp + apache-jsp ${project.version} @@ -133,5 +125,17 @@ war test + + org.eclipse.jetty.alpn + alpn-api + ${alpn.api.version} + provided + + + org.eclipse.jetty + jetty-alpn-server + ${project.version} + test + diff --git a/tests/test-jmx/jmx-webapp-it/pom.xml b/tests/test-jmx/jmx-webapp-it/pom.xml index 5401ae8e540..92d843ba518 100644 --- a/tests/test-jmx/jmx-webapp-it/pom.xml +++ b/tests/test-jmx/jmx-webapp-it/pom.xml @@ -1,26 +1,9 @@ - org.eclipse.jetty.tests test-jmx-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 jmx-webapp-it @@ -31,17 +14,18 @@ UTF-8 UTF-8 ${project.groupId}.jmx.webapp.it - ${project.basedir}/src/test/scripts ${project.build.directory}/test-base - ${project.build.directory}/test-home org.eclipse.jetty - jetty-distribution + jetty-annotations + ${project.version} + + + org.eclipse.jetty + jetty-jmx ${project.version} - zip - runtime org.eclipse.jetty.tests @@ -72,136 +56,14 @@ jmx-webapp runtime war - true - true + true + true true ${test-base-dir}/webapps - - unpack-jetty-distro - process-test-resources - - unpack-dependencies - - - jetty-distribution - runtime - zip - true - ${test-home-dir} - true - true - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.17 - - - - integration-test - verify - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - - - start-jetty - pre-integration-test - - run - - - - - - Integration Test : Setup Jetty - - - - - - - - - Integration Test : Starting Jetty ... - - - - - - - - - - - Integration Test : Jetty is now available - - - - - stop-jetty - post-integration-test - - run - - - - - - Integration Test : Stop Jetty - - - - - - - - - - - - - it-windows - - - Windows - - - - cmd - /c - start-jetty.bat - stop-jetty.bat - - - - it-unix - - - unix - - - - sh - -- - setup-jetty.sh - start-jetty.sh - stop-jetty.sh - - - diff --git a/tests/test-jmx/jmx-webapp/pom.xml b/tests/test-jmx/jmx-webapp/pom.xml index 0e81a58516e..d742b4c7c93 100644 --- a/tests/test-jmx/jmx-webapp/pom.xml +++ b/tests/test-jmx/jmx-webapp/pom.xml @@ -1,27 +1,10 @@ - 4.0.0 org.eclipse.jetty.tests test-jmx-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT jmx-webapp war @@ -54,12 +37,6 @@ true - - org.apache.maven.plugins - maven-war-plugin - - - diff --git a/tests/test-jmx/pom.xml b/tests/test-jmx/pom.xml index 895efd6c865..4698c64f29d 100644 --- a/tests/test-jmx/pom.xml +++ b/tests/test-jmx/pom.xml @@ -1,26 +1,9 @@ - org.eclipse.jetty.tests tests-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT 4.0.0 test-jmx-parent diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index c81bfae9e94..48701d05068 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -1,31 +1,17 @@ - 4.0.0 org.eclipse.jetty.tests tests-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-loginservice Jetty Tests :: Login Service http://www.eclipse.org/jetty + + ${project.groupId}.loginservice + org.eclipse.jetty diff --git a/tests/test-quickstart/pom.xml b/tests/test-quickstart/pom.xml index 2d746a1a3d8..1e9b2b46451 100644 --- a/tests/test-quickstart/pom.xml +++ b/tests/test-quickstart/pom.xml @@ -1,8 +1,9 @@ + org.eclipse.jetty.tests tests-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml 4.0.0 @@ -11,6 +12,9 @@ Test :: Jetty Quick Start Jetty Quick Start Test http://www.eclipse.org/jetty + + ${project.groupId}.tests.quickstart + org.eclipse.jetty @@ -99,14 +103,13 @@ org.eclipse.jetty.toolchain jetty-test-helper - + org.codehaus.mojo appassembler-maven-plugin - 1.7 unix diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index e8f71588145..962172f91c5 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -1,27 +1,10 @@ - 4.0.0 org.eclipse.jetty.tests tests-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-sessions-parent Jetty Tests :: Sessions :: Parent @@ -32,8 +15,8 @@ test-sessions-common test-hash-sessions + test-file-sessions test-jdbc-sessions - test-mongodb-sessions test-infinispan-sessions test-gcloud-sessions diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 428c9bee4b1..b30d3270bb8 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -1,31 +1,17 @@ - 4.0.0 org.eclipse.jetty.tests test-sessions-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-hash-sessions Jetty Tests :: Sessions :: Hash http://www.eclipse.org/jetty + + ${project.groupId}.sessions.hash + diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index 1381813408f..3d7814d0140 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -1,31 +1,17 @@ - 4.0.0 org.eclipse.jetty.tests test-sessions-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-jdbc-sessions Jetty Tests :: Sessions :: JDBC http://www.eclipse.org/jetty + + ${project.groupId}.sessions.jdbc + @@ -62,13 +48,13 @@ org.apache.derby derby - 10.4.1.3 + 10.12.1.1 test org.apache.derby derbytools - 10.4.1.3 + 10.12.1.1 test diff --git a/tests/test-sessions/test-mongodb-sessions/pom.xml b/tests/test-sessions/test-mongodb-sessions/pom.xml index 5ab37303be2..ef3f46f605e 100644 --- a/tests/test-sessions/test-mongodb-sessions/pom.xml +++ b/tests/test-sessions/test-mongodb-sessions/pom.xml @@ -1,31 +1,17 @@ - 4.0.0 org.eclipse.jetty.tests test-sessions-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-mongodb-sessions Jetty Tests :: Sessions :: Mongo http://www.eclipse.org/jetty + + ${project.groupId}.sessions.mongo + diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml index f490464eb28..c4f625724fe 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -1,31 +1,17 @@ - 4.0.0 org.eclipse.jetty.tests test-sessions-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-sessions-common Jetty Tests :: Sessions :: Common http://www.eclipse.org/jetty + + ${project.groupId}.sessions.common + diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index 0d5ff864c45..ab77e4db250 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -1,27 +1,10 @@ - 4.0.0 org.eclipse.jetty.tests tests-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml test-webapps-parent @@ -37,7 +20,7 @@ true - + org.jacoco jacoco-maven-plugin diff --git a/tests/test-webapps/test-jaas-webapp/pom.xml b/tests/test-webapps/test-jaas-webapp/pom.xml index 9f054e9d6c7..02541c39cd3 100644 --- a/tests/test-webapps/test-jaas-webapp/pom.xml +++ b/tests/test-webapps/test-jaas-webapp/pom.xml @@ -4,11 +4,14 @@ org.eclipse.jetty.tests test-webapps-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-jaas-webapp Jetty Tests :: WebApp :: JAAS war + + ${project.groupId}.jaas + @@ -28,8 +31,8 @@ - jetty.home - ${basedir}/src/main/config + jetty.base + ${basedir}/src/main/config/demo-base @@ -47,6 +50,13 @@ + + + mysql + mysql-connector-java + 5.1.19 + + org.apache.maven.plugins diff --git a/tests/test-webapps/test-jetty-webapp/pom.xml b/tests/test-webapps/test-jetty-webapp/pom.xml index 5ea2acb91aa..d9309abff25 100644 --- a/tests/test-webapps/test-jetty-webapp/pom.xml +++ b/tests/test-webapps/test-jetty-webapp/pom.xml @@ -1,26 +1,9 @@ - org.eclipse.jetty.tests test-webapps-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml 4.0.0 @@ -29,6 +12,9 @@ Test :: Jetty Test Webapp http://www.eclipse.org/jetty war + + ${project.groupId}.tests.webapp + @@ -70,15 +56,6 @@ - - - maven-war-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.apache.felix maven-bundle-plugin @@ -87,32 +64,29 @@ war + + javax.servlet.jsp.*;version="[2.2.0,3.0)",org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))",* + !com.acme* + + / + + .,WEB-INF/classes + + + + + + maven-war-plugin + + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + - - - bundle-manifest - process-classes - - manifest - - - - org.eclipse.jetty.test-jetty-webapp - javax.servlet.jsp.*;version="[2.2.0, 3.0)",javax.servlet.*;version="[2.6,3.2)",org.eclipse.jetty.*;version="9.1",* - !com.acme* - - / - - .,WEB-INF/classes - - - - org.eclipse.jetty @@ -143,11 +117,6 @@ /test ${project.build.directory}/work - - - ${basedir}/target/sessions - - @@ -157,6 +126,14 @@ + + org.apache.maven.plugins + maven-deploy-plugin + + + false + + @@ -198,6 +175,13 @@ ${project.version} test + + org.eclipse.jetty + jetty-servlet + ${project.version} + tests + test + org.eclipse.jetty.toolchain jetty-test-helper @@ -215,12 +199,6 @@ 2.1 provided - - org.eclipse.jetty.spdy - spdy-http-server - ${project.version} - test - javax.servlet jstl @@ -249,10 +227,14 @@ jspc + diff --git a/tests/test-webapps/test-jndi-webapp/pom.xml b/tests/test-webapps/test-jndi-webapp/pom.xml index 9b004407398..ecfb628637d 100644 --- a/tests/test-webapps/test-jndi-webapp/pom.xml +++ b/tests/test-webapps/test-jndi-webapp/pom.xml @@ -4,11 +4,14 @@ org.eclipse.jetty.tests test-webapps-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-jndi-webapp Jetty Tests :: WebApp :: JNDI war + + ${project.groupId}.jndi + @@ -69,7 +72,6 @@ org.apache.maven.plugins maven-assembly-plugin - 2.2-beta-3 package @@ -80,18 +82,11 @@ src/main/assembly/config.xml - + - - org.apache.maven.plugins - maven-war-plugin - - - org.eclipse.jetty jetty-maven-plugin diff --git a/tests/test-webapps/test-mock-resources/pom.xml b/tests/test-webapps/test-mock-resources/pom.xml index 600b95e7afa..9aa5f62922e 100644 --- a/tests/test-webapps/test-mock-resources/pom.xml +++ b/tests/test-webapps/test-mock-resources/pom.xml @@ -3,11 +3,14 @@ org.eclipse.jetty.tests test-webapps-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT Jetty Tests :: WebApp :: Mock Resources test-mock-resources jar + + ${project.groupId}.mocks + @@ -22,7 +25,6 @@ true - generate-manifest manifest @@ -44,23 +46,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - @@ -73,12 +58,6 @@ javax.servlet javax.servlet-api - org.eclipse.jetty.orbit javax.mail.glassfish diff --git a/tests/test-webapps/test-proxy-webapp/pom.xml b/tests/test-webapps/test-proxy-webapp/pom.xml index eda969b6085..86fffafd9bf 100644 --- a/tests/test-webapps/test-proxy-webapp/pom.xml +++ b/tests/test-webapps/test-proxy-webapp/pom.xml @@ -1,26 +1,9 @@ - org.eclipse.jetty.tests test-webapps-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT ../pom.xml 4.0.0 @@ -28,6 +11,9 @@ test-proxy-webapp Test :: Jetty Proxy Webapp war + + ${project.groupId}.proxy + @@ -38,6 +24,14 @@ + + org.apache.maven.plugins + maven-deploy-plugin + + + false + + @@ -82,18 +76,30 @@ ${project.version} provided + + org.eclipse.jetty.http2 + http2-server + ${project.version} + test + + + org.eclipse.jetty + jetty-alpn-server + ${project.version} + test + + + org.eclipse.jetty + jetty-annotations + ${project.version} + test + javax.servlet.jsp jsp-api 2.1 provided - - org.eclipse.jetty.spdy - spdy-http-server - ${project.version} - test - javax.servlet jstl diff --git a/tests/test-webapps/test-servlet-spec/pom.xml b/tests/test-webapps/test-servlet-spec/pom.xml index 03af8117aa7..7e412ae69ed 100644 --- a/tests/test-webapps/test-servlet-spec/pom.xml +++ b/tests/test-webapps/test-servlet-spec/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty.tests test-webapps-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-servlet-spec-parent Jetty Tests :: Spec Test WebApp :: Parent diff --git a/tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml b/tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml index 8cb75bbd495..6b1fa7d3eb7 100644 --- a/tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml +++ b/tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml @@ -3,49 +3,20 @@ org.eclipse.jetty.tests test-servlet-spec-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-container-initializer jar Jetty Tests :: WebApp :: Servlet Spec :: ServletContainerInitializer Test Jar + + ${project.groupId}.sci + - - maven-compiler-plugin - - false - - - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - - - target/classes/META-INF/MANIFEST.MF - - - org.apache.felix maven-bundle-plugin true - - - bundle-manifest - process-classes - - manifest - - - org.eclipse.jetty.tests.test-servlet-container-initializer;singleton:=true diff --git a/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml b/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml index 2a9186175c3..81d9032b4ec 100644 --- a/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml +++ b/tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml @@ -4,11 +4,14 @@ org.eclipse.jetty.tests test-servlet-spec-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT Jetty Tests :: Webapps :: Spec Webapp test-spec-webapp war + + ${project.groupId}.spec + @@ -18,7 +21,7 @@ true - + org.apache.maven.plugins maven-assembly-plugin @@ -59,7 +62,6 @@ - org.apache.felix maven-bundle-plugin @@ -68,40 +70,28 @@ war + + org.eclipse.jetty.tests.test-spec-webapp + Test Webapp for Servlet 3.1 Features + + javax.servlet.jsp.*;version="[2.2.0, 3.0)", + javax.transaction*;version="[1.1,1.3)", + javax.servlet*;version="[2.6,3.2)", + org.eclipse.jetty*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))", + org.eclipse.jetty.webapp;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", + org.eclipse.jetty.plus.jndi;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", + com.acme;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}", + * + + <_nouses /> + com.acme.test;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}";-noimport:=true + / + .,WEB-INF/classes,WEB-INF/lib + /META-INF/plugin-context.xml + - - - bundle-manifest - process-classes - - manifest - - - - org.eclipse.jetty.tests.test-spec-webapp - Test Webapp for Servlet 3.1 Features - - javax.servlet.jsp.*;version="[2.2.0, 3.0)", - javax.transaction.*;version="[1.1, 2.0)", - javax.servlet.*;version="3.0", - javax.sql, - org.eclipse.jetty.webapp;version="9.2",org.eclipse.jetty.plus.jndi;version="9.2", - org.eclipse.jetty.security;version="9.2", - com.acme;version="9.2", - * - - com.acme.test;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" - / - .,WEB-INF/classes,WEB-INF/lib - ./META-INF/plugin-context.xml - <_nouses>true - - - - - maven-antrun-plugin @@ -149,24 +139,6 @@ - org.eclipse.jetty jetty-maven-plugin @@ -200,6 +172,7 @@ + javax.transaction diff --git a/tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml b/tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml index 39e96fc4152..21722e8cdbb 100644 --- a/tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml +++ b/tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml @@ -3,12 +3,15 @@ org.eclipse.jetty.tests test-servlet-spec-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT Jetty Tests :: WebApp :: Servlet Spec :: Fragment Jar org.eclipse.jetty.tests test-web-fragment jar + + ${project.groupId}.fragment + @@ -17,46 +20,6 @@ false - - org.apache.maven.plugins - maven-jar-plugin - - - artifact-jar - - jar - - - - - - target/classes/META-INF/MANIFEST.MF - - - - - org.apache.felix - maven-bundle-plugin - true - - - bundle-manifest - process-classes - - manifest - - - - - - org.eclipse.jetty.tests.test-web-fragment;singleton:=true - A bundle containing web fragment for testing - com.acme.fragment;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" - <_nouses>true - - - - @@ -64,5 +27,12 @@ javax.servlet javax.servlet-api + + diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index a3e0aecc037..7f6f901ee26 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -1,32 +1,18 @@ - 4.0.0 org.eclipse.jetty.tests test-webapps-parent - 9.2.23-SNAPSHOT + 9.4.7-SNAPSHOT test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 http://www.eclipse.org/jetty war + + ${project.groupId}.rfc2616 +