Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-10.0.x-3290-websocket-onOpen

This commit is contained in:
Greg Wilkins 2019-01-26 18:16:30 +11:00
commit 1171d7c8d7
32 changed files with 318 additions and 336 deletions

4
Jenkinsfile vendored
View File

@ -10,7 +10,7 @@ pipeline {
agent { node { label 'linux' } } agent { node { label 'linux' } }
options { timeout(time: 120, unit: 'MINUTES') } options { timeout(time: 120, unit: 'MINUTES') }
steps { steps {
mavenBuild("jdk11", "-Pmongodb install", "maven3") mavenBuild("jdk11", "-Pautobahn -Pmongodb install", "maven3")
warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'Java']] warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'Java']]
// Collect up the jacoco execution results (only on main build) // Collect up the jacoco execution results (only on main build)
jacoco inclusionPattern: '**/org/eclipse/jetty/**/*.class', jacoco inclusionPattern: '**/org/eclipse/jetty/**/*.class',
@ -86,7 +86,7 @@ def mavenBuild(jdk, cmdline, mvnName) {
mavenOpts: mavenOpts, mavenOpts: mavenOpts,
mavenLocalRepo: localRepo) { mavenLocalRepo: localRepo) {
// Some common Maven command line + provided command line // Some common Maven command line + provided command line
sh "mvn -V -B -T3 -e -Dmaven.test.failure.ignore=true -Djetty.testtracker.log=true $cmdline -Dunix.socket.tmp=" + env.JENKINS_HOME sh "mvn -V -B -T3 -e -fae -Dmaven.test.failure.ignore=true -Djetty.testtracker.log=true $cmdline -Dunix.socket.tmp=" + env.JENKINS_HOME
} }
} }

View File

@ -62,7 +62,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -326,22 +326,27 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-api</artifactId> <artifactId>javax-websocket-common</artifactId>
<version>10.0.0-SNAPSHOT</version> <version>10.0.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId> <artifactId>jetty-websocket-api</artifactId>
<version>10.0.0-SNAPSHOT</version> <version>10.0.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-common</artifactId> <artifactId>jetty-websocket-client</artifactId>
<version>10.0.0-SNAPSHOT</version> <version>10.0.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-common</artifactId>
<version>10.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-server</artifactId>
<version>10.0.0-SNAPSHOT</version> <version>10.0.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@ -349,6 +354,11 @@
<artifactId>websocket-servlet</artifactId> <artifactId>websocket-servlet</artifactId>
<version>10.0.0-SNAPSHOT</version> <version>10.0.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-core</artifactId>
<version>10.0.0-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-xml</artifactId> <artifactId>jetty-xml</artifactId>

View File

@ -18,15 +18,6 @@
package org.eclipse.jetty.client; package org.eclipse.jetty.client;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
@ -53,17 +44,22 @@ import org.eclipse.jetty.io.ssl.SslHandshakeListener;
import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.util.JavaVersion;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.ExecutorThreadPool; import org.eclipse.jetty.util.thread.ExecutorThreadPool;
import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnJre; import org.junit.jupiter.api.condition.DisabledOnJre;
import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.condition.JRE;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class HttpClientTLSTest public class HttpClientTLSTest
{ {
private Server server; private Server server;
@ -114,7 +110,7 @@ public class HttpClientTLSTest
public void testNoCommonTLSProtocol() throws Exception public void testNoCommonTLSProtocol() throws Exception
{ {
SslContextFactory serverTLSFactory = createSslContextFactory(); SslContextFactory serverTLSFactory = createSslContextFactory();
serverTLSFactory.setIncludeProtocols("TLSv1.2"); serverTLSFactory.setIncludeProtocols("TLSv1.3");
startServer(serverTLSFactory, new EmptyServerHandler()); startServer(serverTLSFactory, new EmptyServerHandler());
CountDownLatch serverLatch = new CountDownLatch(1); CountDownLatch serverLatch = new CountDownLatch(1);
@ -128,7 +124,7 @@ public class HttpClientTLSTest
}); });
SslContextFactory clientTLSFactory = createSslContextFactory(); SslContextFactory clientTLSFactory = createSslContextFactory();
clientTLSFactory.setIncludeProtocols("TLSv1.1"); clientTLSFactory.setIncludeProtocols("TLSv1.2");
startClient(clientTLSFactory); startClient(clientTLSFactory);
CountDownLatch clientLatch = new CountDownLatch(1); CountDownLatch clientLatch = new CountDownLatch(1);
@ -141,7 +137,8 @@ public class HttpClientTLSTest
} }
}); });
assertThrows(ExecutionException.class, ()->{ assertThrows(ExecutionException.class, () ->
{
client.newRequest("localhost", connector.getLocalPort()) client.newRequest("localhost", connector.getLocalPort())
.scheme(HttpScheme.HTTPS.asString()) .scheme(HttpScheme.HTTPS.asString())
.timeout(5, TimeUnit.SECONDS) .timeout(5, TimeUnit.SECONDS)
@ -183,7 +180,8 @@ public class HttpClientTLSTest
} }
}); });
assertThrows(ExecutionException.class, ()->{ assertThrows(ExecutionException.class, () ->
{
client.newRequest("localhost", connector.getLocalPort()) client.newRequest("localhost", connector.getLocalPort())
.scheme(HttpScheme.HTTPS.asString()) .scheme(HttpScheme.HTTPS.asString())
.timeout(5, TimeUnit.SECONDS) .timeout(5, TimeUnit.SECONDS)
@ -226,7 +224,8 @@ public class HttpClientTLSTest
} }
}); });
assertThrows(ExecutionException.class, ()->{ assertThrows(ExecutionException.class, () ->
{
client.newRequest("localhost", connector.getLocalPort()) client.newRequest("localhost", connector.getLocalPort())
.scheme(HttpScheme.HTTPS.asString()) .scheme(HttpScheme.HTTPS.asString())
.timeout(5, TimeUnit.SECONDS) .timeout(5, TimeUnit.SECONDS)
@ -239,7 +238,7 @@ public class HttpClientTLSTest
// In JDK 11, a mismatch on the client does not generate any bytes towards // In JDK 11, a mismatch on the client does not generate any bytes towards
// the server, while in TLS 1.2 the client sends to the server the close_notify. // the server, while in TLS 1.2 the client sends to the server the close_notify.
@DisabledOnJre( JRE.JAVA_11 ) @DisabledOnJre(JRE.JAVA_11)
@Test @Test
public void testMismatchBetweenTLSProtocolAndTLSCiphersOnClient() throws Exception public void testMismatchBetweenTLSProtocolAndTLSCiphersOnClient() throws Exception
{ {
@ -273,7 +272,8 @@ public class HttpClientTLSTest
} }
}); });
assertThrows(ExecutionException.class, ()->{ assertThrows(ExecutionException.class, () ->
{
client.newRequest("localhost", connector.getLocalPort()) client.newRequest("localhost", connector.getLocalPort())
.scheme(HttpScheme.HTTPS.asString()) .scheme(HttpScheme.HTTPS.asString())
.timeout(5, TimeUnit.SECONDS) .timeout(5, TimeUnit.SECONDS)
@ -321,7 +321,7 @@ public class HttpClientTLSTest
} }
// Excluded because of a bug in JDK 11+27 where session resumption does not work. // Excluded because of a bug in JDK 11+27 where session resumption does not work.
@DisabledOnJre( JRE.JAVA_11 ) @DisabledOnJre(JRE.JAVA_11)
@Test @Test
public void testHandshakeSucceededWithSessionResumption() throws Exception public void testHandshakeSucceededWithSessionResumption() throws Exception
{ {
@ -401,7 +401,7 @@ public class HttpClientTLSTest
} }
// Excluded because of a bug in JDK 11+27 where session resumption does not work. // Excluded because of a bug in JDK 11+27 where session resumption does not work.
@DisabledOnJre( JRE.JAVA_11 ) @DisabledOnJre(JRE.JAVA_11)
@Test @Test
public void testClientRawCloseDoesNotInvalidateSession() throws Exception public void testClientRawCloseDoesNotInvalidateSession() throws Exception
{ {

View File

@ -67,7 +67,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

View File

@ -58,7 +58,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

View File

@ -590,7 +590,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -10,7 +10,6 @@
<name>Jetty :: Jetty JSPC Maven Plugin</name> <name>Jetty :: Jetty JSPC Maven Plugin</name>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.jspc.plugin</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.jspc.plugin</bundle-symbolic-name>
<it.debug>false</it.debug>
</properties> </properties>
<build> <build>
<plugins> <plugins>
@ -56,20 +55,10 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<debug>${it.debug}</debug>
<addTestClassPath>true</addTestClassPath> <addTestClassPath>true</addTestClassPath>
<timeoutInSeconds>60</timeoutInSeconds>
<projectsDirectory>src/it</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
<scriptVariables> <scriptVariables>
<maven.surefire.version>${maven.surefire.version}</maven.surefire.version> <maven.surefire.version>${maven.surefire.version}</maven.surefire.version>
</scriptVariables> </scriptVariables>
<skipInvocation>${skipTests}</skipInvocation>
<goals> <goals>
<goal>clean</goal> <goal>clean</goal>
</goals> </goals>

View File

@ -11,7 +11,6 @@
<description>Jetty maven plugins</description> <description>Jetty maven plugins</description>
<properties> <properties>
<bundle-symbolic-name>${project.groupId}.maven.plugin</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.maven.plugin</bundle-symbolic-name>
<it.debug>false</it.debug>
<jetty.stopKey>FREEBEER</jetty.stopKey> <jetty.stopKey>FREEBEER</jetty.stopKey>
<jetty.jvmArgs></jetty.jvmArgs> <jetty.jvmArgs></jetty.jvmArgs>
</properties> </properties>
@ -62,29 +61,15 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<javaHome>${java.home}</javaHome>
<environmentVariables>
<JAVA_HOME>${java.home}</JAVA_HOME>
</environmentVariables>
<debug>${it.debug}</debug>
<addTestClassPath>true</addTestClassPath> <addTestClassPath>true</addTestClassPath>
<projectsDirectory>src/it</projectsDirectory>
<timeoutInSeconds>600</timeoutInSeconds>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<setupIncludes> <setupIncludes>
<setupInclude>it-parent-pom/pom.xml</setupInclude> <setupInclude>it-parent-pom/pom.xml</setupInclude>
</setupIncludes> </setupIncludes>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
<scriptVariables> <scriptVariables>
<jettyStopKey>${jetty.stopKey}</jettyStopKey> <jettyStopKey>${jetty.stopKey}</jettyStopKey>
<jettyStopPort>${jetty.stopPort}</jettyStopPort> <jettyStopPort>${jetty.stopPort}</jettyStopPort>
<maven.surefire.version>${maven.surefire.version}</maven.surefire.version> <maven.surefire.version>${maven.surefire.version}</maven.surefire.version>
</scriptVariables> </scriptVariables>
<skipInvocation>${skipTests}</skipInvocation>
<goals> <goals>
<goal>clean</goal> <goal>clean</goal>
</goals> </goals>
@ -144,11 +129,6 @@
<artifactId>maven-artifact-transfer</artifactId> <artifactId>maven-artifact-transfer</artifactId>
<version>0.9.1</version> <version>0.9.1</version>
</dependency> </dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId> <artifactId>jetty-util</artifactId>
@ -227,7 +207,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -0,0 +1 @@
invoker.goals = test

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.its</groupId>
<artifactId>it-parent-pom</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>jetty-run-mojo-jsp</artifactId>
<packaging>war</packaging>
<name>Jetty :: Simple :: Webapp</name>
<properties>
<jetty.port.file>${project.build.directory}/jetty-run-mojo-jsp.txt</jetty.port.file>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<jetty.port.file>${jetty.port.file}</jetty.port.file>
<contentCheck>Counter accessed 1 times.</contentCheck>
<pathToCheck>/jsp/bean1.jsp</pathToCheck>
<maven.it.name>${project.groupId}:${project.artifactId}</maven.it.name>
</systemPropertyVariables>
<dependenciesToScan>
<dependency>org.eclipse.jetty:jetty-maven-plugin</dependency>
</dependenciesToScan>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<executions>
<execution>
<id>start-jetty</id>
<phase>test-compile</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<systemProperties>
<systemProperty>
<name>jetty.port.file</name>
<value>${jetty.port.file}</value>
</systemProperty>
</systemProperties>
<nonBlocking>true</nonBlocking>
<jettyXml>${basedir}/src/config/jetty.xml</jettyXml>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
File buildLog = new File( basedir, 'build.log' )
assert buildLog.text.contains( 'Started Jetty Server' )
assert buildLog.text.contains( 'Running org.eclipse.jetty.maven.plugin.it.TestGetContent')
assert buildLog.text.contains( 'contentCheck')

View File

@ -0,0 +1,40 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Set name="secureScheme">https</Set>
<Set name="securePort"><Property name="jetty.secure.port" default="8443" /></Set>
<Set name="outputBufferSize">32768</Set>
<Set name="requestHeaderSize">8192</Set>
<Set name="responseHeaderSize">8192</Set>
<Set name="headerCacheSize">4096</Set>
</New>
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="httpConfig" /></Arg>
</New>
</Item>
</Array>
</Arg>
<Call name="addLifeCycleListener">
<Arg>
<New class="org.eclipse.jetty.maven.plugin.ServerConnectorListener">
<Set name="fileName"><Property name="jetty.port.file" default="port.txt"/></Set>
</New>
</Arg>
</Call>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="0" />0</Set>
<Set name="idleTimeout">30000</Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -0,0 +1,41 @@
//
// ========================================================================
// Copyright (c) 1995-2019 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 com.acme;
@SuppressWarnings("serial")
public class Counter implements java.io.Serializable
{
int counter=0;
String last;
public int getCount()
{
counter++;
return counter;
}
public void setLast(String uri) {
last=uri;
}
public String getLast() {
return last;
}
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Jetty Simple Webapp run-mojo-jsp</display-name>
</web-app>

View File

@ -0,0 +1,13 @@
<html>
<%@ page session="true"%>
<body>
<jsp:useBean id='counter' scope='session' class='com.acme.Counter' type="com.acme.Counter" />
<h1>JSP1.2 Beans: 1</h1>
Counter accessed <jsp:getProperty name="counter" property="count"/> times.<br/>
Counter last accessed by <jsp:getProperty name="counter" property="last"/><br/>
<jsp:setProperty name="counter" property="last" value="<%= request.getRequestURI()%>"/>
</body>
</html>

View File

@ -64,9 +64,15 @@ public class TestGetContent
System.out.println( "pingServlet ok" ); System.out.println( "pingServlet ok" );
} }
String contentCheck = System.getProperty( "contentCheck" ); String contentCheck = System.getProperty( "contentCheck" );
String pathToCheck = System.getProperty( "pathToCheck" );
if(StringUtils.isNotBlank( contentCheck ) ) if(StringUtils.isNotBlank( contentCheck ) )
{ {
String response = httpClient.GET( "http://localhost:" + port ).getContentAsString(); String url = "http://localhost:" + port;
if(pathToCheck!=null)
{
url += pathToCheck;
}
String response = httpClient.GET( url ).getContentAsString();
assertTrue(response.contains(contentCheck), "it test " + System.getProperty( "maven.it.name" ) assertTrue(response.contains(contentCheck), "it test " + System.getProperty( "maven.it.name" )
+ ", response not contentCheck: " + contentCheck + ", response:" + response); + ", response not contentCheck: " + contentCheck + ", response:" + response);
System.out.println( "contentCheck" ); System.out.println( "contentCheck" );

View File

@ -293,7 +293,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId> <artifactId>jetty-websocket-client</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
@ -311,7 +311,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>

View File

@ -133,8 +133,8 @@ public class TestOSGiUtil
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "jetty-websocket-api" ).versionAsInProject().start()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "jetty-websocket-api" ).versionAsInProject().start());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "jetty-websocket-common" ).versionAsInProject().start()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "jetty-websocket-common" ).versionAsInProject().start());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-servlet" ).versionAsInProject().start()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-servlet" ).versionAsInProject().start());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-server" ).versionAsInProject().start()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "jetty-websocket-server" ).versionAsInProject().start());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-client" ).versionAsInProject().start()); res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "jetty-websocket-client" ).versionAsInProject().start());
res.add(mavenBundle().groupId("org.eclipse.jetty.websocket").artifactId("javax-websocket-common").versionAsInProject().noStart()); res.add(mavenBundle().groupId("org.eclipse.jetty.websocket").artifactId("javax-websocket-common").versionAsInProject().noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.websocket").artifactId("javax-websocket-client").versionAsInProject().noStart()); res.add(mavenBundle().groupId("org.eclipse.jetty.websocket").artifactId("javax-websocket-client").versionAsInProject().noStart());

View File

@ -11,7 +11,6 @@
<properties> <properties>
<assembly-directory>target/distribution</assembly-directory> <assembly-directory>target/distribution</assembly-directory>
<bundle-symbolic-name>${project.groupId}.runner</bundle-symbolic-name> <bundle-symbolic-name>${project.groupId}.runner</bundle-symbolic-name>
<it.debug>false</it.debug>
</properties> </properties>
<build> <build>
@ -51,17 +50,6 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<javaHome>${java.home}</javaHome>
<environmentVariables>
<JAVA_HOME>${java.home}</JAVA_HOME>
</environmentVariables>
<debug>${it.debug}</debug>
<projectsDirectory>src/it</projectsDirectory>
<timeoutInSeconds>600</timeoutInSeconds>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
<skipInvocation>${skipTests}</skipInvocation>
<scriptVariables> <scriptVariables>
<maven.dependency.plugin.version>${maven.dependency.plugin.version}</maven.dependency.plugin.version> <maven.dependency.plugin.version>${maven.dependency.plugin.version}</maven.dependency.plugin.version>
</scriptVariables> </scriptVariables>
@ -125,7 +113,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>websocket-client</artifactId> <artifactId>jetty-websocket-client</artifactId>
<name>Jetty :: Websocket :: org.eclipse.jetty.websocket :: Client</name> <name>Jetty :: Websocket :: org.eclipse.jetty.websocket :: Client</name>
<properties> <properties>

View File

@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-server</artifactId>
<name>Jetty :: Websocket :: org.eclipse.jetty.websocket :: Server</name> <name>Jetty :: Websocket :: org.eclipse.jetty.websocket :: Server</name>
<properties> <properties>

View File

@ -110,7 +110,7 @@
<plugin> <plugin>
<groupId>me.normanmaurer.maven.autobahntestsuite</groupId> <groupId>me.normanmaurer.maven.autobahntestsuite</groupId>
<artifactId>autobahntestsuite-maven-plugin</artifactId> <artifactId>autobahntestsuite-maven-plugin</artifactId>
<version>0.1.4</version> <version>0.1.6</version>
<configuration> <configuration>
<!-- Optional configuration --> <!-- Optional configuration -->
@ -123,7 +123,7 @@
<cases> <cases>
<case>*</case> <case>*</case>
</cases> </cases>
<testFailureIgnore>true</testFailureIgnore>
<excludeCases></excludeCases> <excludeCases></excludeCases>
<failOnNonStrict>false</failOnNonStrict> <failOnNonStrict>false</failOnNonStrict>
</configuration> </configuration>
@ -134,9 +134,7 @@
<goal>fuzzingclient</goal> <goal>fuzzingclient</goal>
</goals> </goals>
<configuration> <configuration>
<!-- The class which contains a main method that accept the port as parameter and startup the --> <!-- The class that contains a main method which accepts the port as a parameter to start the server. -->
<!-- the server. -->
<!--mainClass>org.eclipse.jetty.websocket.autobahn.WebSocketServer</mainClass-->
<mainClass>org.eclipse.jetty.websocket.core.autobahn.AutobahnWebSocketServer</mainClass> <mainClass>org.eclipse.jetty.websocket.core.autobahn.AutobahnWebSocketServer</mainClass>
</configuration> </configuration>
</execution> </execution>

View File

@ -84,7 +84,9 @@ class AutobahnWebSocketNegotiator implements WebSocketNegotiator
@Override @Override
public void customize(FrameHandler.CoreSession session) public void customize(FrameHandler.CoreSession session)
{ {
session.setIdleTimeout(Duration.ofMillis(5000)); session.setIdleTimeout(Duration.ofMillis(10000));
session.setMaxTextMessageSize(Integer.MAX_VALUE);
session.setMaxBinaryMessageSize(Integer.MAX_VALUE);
session.setMaxFrameSize(65536*2); session.setMaxFrameSize(65536*2);
} }

27
pom.xml
View File

@ -78,6 +78,7 @@
<maven.plugin-tools.version>3.5.2</maven.plugin-tools.version> <maven.plugin-tools.version>3.5.2</maven.plugin-tools.version>
<!-- testing --> <!-- testing -->
<it.debug>false</it.debug>
<jetty.test.version>5.2</jetty.test.version> <jetty.test.version>5.2</jetty.test.version>
<!-- springboot is only used for jetty-maven-plugin it test <!-- springboot is only used for jetty-maven-plugin it test
otherwise depending on Spring Boot might be chicken and egg issue :) --> otherwise depending on Spring Boot might be chicken and egg issue :) -->
@ -179,7 +180,11 @@
<versionOsgiRule implementation="org.eclipse.jetty.toolchain.enforcer.rules.RequireOsgiCompatibleVersionRule" /> <versionOsgiRule implementation="org.eclipse.jetty.toolchain.enforcer.rules.RequireOsgiCompatibleVersionRule" />
<versionRedhatRule implementation="org.eclipse.jetty.toolchain.enforcer.rules.RequireRedhatCompatibleVersionRule" /> <versionRedhatRule implementation="org.eclipse.jetty.toolchain.enforcer.rules.RequireRedhatCompatibleVersionRule" />
<versionDebianRule implementation="org.eclipse.jetty.toolchain.enforcer.rules.RequireDebianCompatibleVersionRule" /> <versionDebianRule implementation="org.eclipse.jetty.toolchain.enforcer.rules.RequireDebianCompatibleVersionRule" />
<requireUpperBoundDeps/> <requireUpperBoundDeps>
<excludes>
<exclude>javax.enterprise:cdi-api</exclude>
</excludes>
</requireUpperBoundDeps>
</rules> </rules>
</configuration> </configuration>
</execution> </execution>
@ -486,7 +491,23 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId> <artifactId>maven-invoker-plugin</artifactId>
<version>3.1.0</version> <version>3.2.0</version>
<configuration>
<debug>${it.debug}</debug>
<javaHome>${java.home}</javaHome>
<environmentVariables>
<JAVA_HOME>${java.home}</JAVA_HOME>
</environmentVariables>
<projectsDirectory>src/it</projectsDirectory>
<timeoutInSeconds>300</timeoutInSeconds>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
<skipInvocation>${skipTests}</skipInvocation>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -529,10 +550,12 @@
<detectJavaApiLink>false</detectJavaApiLink> <detectJavaApiLink>false</detectJavaApiLink>
<show>protected</show> <show>protected</show>
<excludePackageNames>com.acme.*;org.slf4j.*;org.mortbay.*</excludePackageNames> <excludePackageNames>com.acme.*;org.slf4j.*;org.mortbay.*</excludePackageNames>
<!-- broken build with jdk 11.0.2
<links> <links>
<link>http://docs.oracle.com/javase/8/docs/api/</link> <link>http://docs.oracle.com/javase/8/docs/api/</link>
<link>http://docs.oracle.com/javaee/7/api/</link> <link>http://docs.oracle.com/javaee/7/api/</link>
</links> </links>
-->
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -68,9 +68,5 @@
<module>test-quickstart</module> <module>test-quickstart</module>
<module>test-jmx</module> <module>test-jmx</module>
<module>test-http-client-transport</module> <module>test-http-client-transport</module>
<!--
autobahn run might be in an other module
<module>test-websocket-autobahn</module>
-->
</modules> </modules>
</project> </project>

View File

@ -85,7 +85,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -219,7 +219,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId> <artifactId>jetty-websocket-server</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

View File

@ -1,77 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>tests-parent</artifactId>
<version>10.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>test-websocket-autobahn</artifactId>
<name>Test :: Jetty Websocket Autobahn</name>
<description>Jetty Websocket Autobahn test suite</description>
<url>http://www.eclipse.org/jetty</url>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>javax-websocket-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>autobahn</id>
<activation>
<property>
<name>autobahn</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>me.normanmaurer.maven.autobahntestsuite</groupId>
<artifactId>autobahntestsuite-maven-plugin</artifactId>
<version>0.1.4</version>
<configuration>
<!-- Optional configuration -->
<!-- The port to bind the server on. Default is to choose a random free port. -->
<!--port>9090</port-->
<!-- The number of milliseconds to wait for the server to startup -->
<waitTime>20000</waitTime>
<generateJUnitXml>true</generateJUnitXml>
<cases>
<case>*</case>
</cases>
<excludeCases></excludeCases>
<failOnNonStrict>false</failOnNonStrict>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>fuzzingclient</goal>
</goals>
<configuration>
<!-- The class which contains a main method that accept the port as parameter and startup the -->
<!-- the server. -->
<!--mainClass>org.eclipse.jetty.websocket.autobahn.WebSocketServer</mainClass-->
<mainClass>org.eclipse.jetty.websocket.autobahn.WebSocketJsrServer</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -1,74 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2019 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.websocket.autobahn;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.websocket.javax.server.JavaxWebSocketServerContainerInitializer;
import javax.websocket.EndpointConfig;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerContainer;
import javax.websocket.server.ServerEndpoint;
/**
* Example of setting up a javax.websocket server with Jetty embedded
*/
public class WebSocketJsrServer
{
/**
* A server socket endpoint
*/
@ServerEndpoint( value = "/" )
public static class EchoJsrSocket
{
@OnMessage
public void onMessage( Session session, String message )
{
session.getAsyncRemote().sendText( message );
}
@OnOpen
public void onOpen( Session session, EndpointConfig endpointConfig ){
session.setMaxTextMessageBufferSize( Integer.MAX_VALUE );
session.setMaxBinaryMessageBufferSize( Integer.MAX_VALUE );
}
}
public static void main( String[] args )
throws Exception
{
Server server = new Server( Integer.parseInt( args[0] ) );
ServletContextHandler context = new ServletContextHandler( ServletContextHandler.SESSIONS );
context.setContextPath( "/" );
server.setHandler( context );
ServerContainer wsContainer = JavaxWebSocketServerContainerInitializer.configureContext( context );
wsContainer.addEndpoint( EchoJsrSocket.class );
server.start();
context.dumpStdErr();
server.join();
}
}

View File

@ -1,82 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2019 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.websocket.autobahn;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
/**
* Example of setting up a Jetty WebSocket server
* <p>
* Note: this uses the Jetty WebSocket API, not the javax.websocket API.
*/
public class WebSocketServer
{
/**
* Example of a Jetty API WebSocket Echo Socket
*/
@WebSocket
public static class EchoSocket
{
@OnWebSocketMessage
public void onMessage( Session session, String message )
{
session.getRemote().sendStringByFuture( message );
}
}
/**
* Servlet layer
*/
@SuppressWarnings( "serial" )
public static class EchoServlet
extends WebSocketServlet
{
@Override
public void configure( WebSocketServletFactory factory )
{
factory.addMapping( factory.parsePathSpec( "/" ), ( req, res ) -> new EchoSocket() );
}
}
public static void main( String[] args )
throws Exception
{
//Log.getLog().setDebugEnabled( true );
Server server = new Server( Integer.parseInt( args[0] ) );
//Server server = new Server(9090);
ServletContextHandler context = new ServletContextHandler( ServletContextHandler.SESSIONS );
context.setContextPath( "/" );
server.setHandler( context );
// Add the echo socket servlet to the /echo path map
context.addServlet( new ServletHolder( EchoServlet.class ), "/" );
server.start();
context.dumpStdErr();
server.join();
}
}

View File

@ -1,6 +0,0 @@
# Setup default logging implementation for during testing
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
org.eclipse.jetty.LEVEL=INFO
#org.eclipse.jetty.util.PathWatcher.LEVEL=DEBUG
#org.eclipse.jetty.util.thread.QueuedThreadPool.LEVEL=DEBUG
#org.eclipse.jetty.util.thread.ReservedThreadExecutor.LEVEL=DEBUG