Merge pull request #3644 from eclipse/jetty-10.0.x-3197-jetty-websocket-jar

Fixes #3197 - Use jetty specific websocket API jar.
This commit is contained in:
Joakim Erdfelt 2019-05-14 09:18:42 -05:00 committed by GitHub
commit 9eea85e68e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 26 additions and 50 deletions

View File

@ -209,8 +209,8 @@
</dependency> </dependency>
<!-- dependencies that jetty-all needs (some optional) --> <!-- dependencies that jetty-all needs (some optional) -->
<dependency> <dependency>
<groupId>javax.websocket</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>javax.websocket-api</artifactId> <artifactId>jetty-javax-websocket-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.toolchain</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>

View File

@ -144,8 +144,8 @@
</dependency> </dependency>
<!-- dependencies that jetty-all needs (some optional) --> <!-- dependencies that jetty-all needs (some optional) -->
<dependency> <dependency>
<groupId>javax.websocket</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>javax.websocket-api</artifactId> <artifactId>jetty-javax-websocket-api</artifactId>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -315,8 +315,8 @@
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.websocket</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>javax.websocket-api</artifactId> <artifactId>jetty-javax-websocket-api</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -18,7 +18,6 @@
package org.eclipse.jetty.osgi.test; package org.eclipse.jetty.osgi.test;
import java.io.InputStream;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -30,15 +29,12 @@ import javax.websocket.RemoteEndpoint;
import javax.websocket.Session; import javax.websocket.Session;
import javax.websocket.WebSocketContainer; import javax.websocket.WebSocketContainer;
import aQute.bnd.osgi.Constants;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.CoreOptions; import org.ops4j.pax.exam.CoreOptions;
import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.tinybundles.core.TinyBundle;
import org.ops4j.pax.tinybundles.core.TinyBundles;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException; import org.osgi.framework.BundleException;
@ -112,8 +108,6 @@ public class TestJettyOSGiBootWithJavaxWebSocket
@Test @Test
public void testWebsocket() throws Exception public void testWebsocket() throws Exception
{ {
fixJavaxWebSocketApi();
startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.common"); startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.common");
startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.client"); startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.client");
startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.server"); startBundle(bundleContext, "org.eclipse.jetty.websocket.javax.websocket.server");
@ -143,24 +137,6 @@ public class TestJettyOSGiBootWithJavaxWebSocket
} }
} }
private void fixJavaxWebSocketApi() throws BundleException
{
// this is necessary because the javax.websocket-api jar does not have manifest headers
// that allow it to use ServiceLoader in osgi, this corrects that defect
TinyBundle bundle = TinyBundles.bundle();
bundle.set(Constants.FRAGMENT_HOST, "javax.websocket-api");
bundle.set(Constants.REQUIRE_CAPABILITY,
"osgi.serviceloader;filter:=\"(osgi.serviceloader=javax.websocket.ContainerProvider)\";resolution:=optional;cardinality:=multiple, osgi.extender; filter:=\"(osgi.extender=osgi.serviceloader.processor)\"");
bundle.set(Constants.BUNDLE_SYMBOLICNAME, "javax.websocket.api.fragment");
InputStream is = bundle.build(TinyBundles.withBnd());
bundleContext.installBundle("dummyLocation", is);
Bundle websocketApiBundle = TestOSGiUtil.getBundle(bundleContext, "javax.websocket-api");
assertNotNull(websocketApiBundle);
websocketApiBundle.update();
websocketApiBundle.start();
}
private void startBundle(BundleContext bundleContext, String symbolicName) throws BundleException private void startBundle(BundleContext bundleContext, String symbolicName) throws BundleException
{ {
Bundle bundle = TestOSGiUtil.getBundle(bundleContext, symbolicName); Bundle bundle = TestOSGiUtil.getBundle(bundleContext, symbolicName);

View File

@ -146,7 +146,7 @@ public class TestOSGiUtil
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());
res.add(mavenBundle().groupId("org.eclipse.jetty.websocket").artifactId("javax-websocket-server").versionAsInProject().noStart()); res.add(mavenBundle().groupId("org.eclipse.jetty.websocket").artifactId("javax-websocket-server").versionAsInProject().noStart());
res.add(mavenBundle().groupId("javax.websocket").artifactId("javax.websocket-api").versionAsInProject().noStart()); res.add(mavenBundle().groupId("org.eclipse.jetty.toolchain").artifactId("jetty-javax-websocket-api").versionAsInProject().noStart());
res.add(mavenBundle().groupId( "org.eclipse.jetty.osgi" ).artifactId( "jetty-osgi-boot" ).versionAsInProject().start()); res.add(mavenBundle().groupId( "org.eclipse.jetty.osgi" ).artifactId( "jetty-osgi-boot" ).versionAsInProject().start());
return res; return res;
} }

View File

@ -28,8 +28,8 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.websocket</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>javax.websocket-api</artifactId> <artifactId>jetty-javax-websocket-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.toolchain</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>

View File

@ -24,7 +24,7 @@ module org.eclipse.jetty.websocket.javax.client
{ {
exports org.eclipse.jetty.websocket.javax.client; exports org.eclipse.jetty.websocket.javax.client;
requires javax.websocket.api; requires jetty.websocket.api;
requires org.eclipse.jetty.client; requires org.eclipse.jetty.client;
requires org.eclipse.jetty.http; requires org.eclipse.jetty.http;
requires org.eclipse.jetty.io; requires org.eclipse.jetty.io;

View File

@ -74,8 +74,8 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.websocket</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>javax.websocket-api</artifactId> <artifactId>jetty-javax-websocket-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -24,7 +24,7 @@ module org.eclipse.jetty.websocket.javax.common
exports org.eclipse.jetty.websocket.javax.common.messages; exports org.eclipse.jetty.websocket.javax.common.messages;
exports org.eclipse.jetty.websocket.javax.common.util; exports org.eclipse.jetty.websocket.javax.common.util;
requires javax.websocket.api; requires jetty.websocket.api;
requires org.eclipse.jetty.http; requires org.eclipse.jetty.http;
requires org.eclipse.jetty.io; requires org.eclipse.jetty.io;
requires org.eclipse.jetty.util; requires org.eclipse.jetty.util;

View File

@ -33,8 +33,8 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.websocket</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>javax.websocket-api</artifactId> <artifactId>jetty-javax-websocket-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.toolchain</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>

View File

@ -29,7 +29,7 @@ module org.eclipse.jetty.websocket.javax.server
exports org.eclipse.jetty.websocket.javax.server; exports org.eclipse.jetty.websocket.javax.server;
requires jetty.servlet.api; requires jetty.servlet.api;
requires javax.websocket.api; requires jetty.websocket.api;
requires org.eclipse.jetty.client; requires org.eclipse.jetty.client;
requires org.eclipse.jetty.http; requires org.eclipse.jetty.http;
requires org.eclipse.jetty.io; requires org.eclipse.jetty.io;

View File

@ -33,8 +33,8 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.websocket</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>javax.websocket-api</artifactId> <artifactId>jetty-javax-websocket-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty.toolchain</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>

View File

@ -908,9 +908,9 @@
<version>${servlet.api.version}</version> <version>${servlet.api.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.websocket</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>javax.websocket-api</artifactId> <artifactId>jetty-javax-websocket-api</artifactId>
<version>1.1</version> <version>1.1.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jakarta.annotation</groupId> <groupId>jakarta.annotation</groupId>

View File

@ -195,8 +195,8 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.websocket</groupId> <groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>javax.websocket-api</artifactId> <artifactId>jetty-javax-websocket-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>