Skip to content

Commit

Permalink
Issue #4568 - remaining renames from outside websocket modules
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
  • Loading branch information
lachlan-roberts committed Mar 4, 2020
1 parent 09e076d commit 8595534
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 26 deletions.
Expand Up @@ -30,7 +30,7 @@
/**
* Example of setting up a jakarta.websocket server with Jetty embedded
*/
public class WebSocketJsrServer
public class WebSocketJakartaServer
{
/**
* A server socket endpoint
Expand Down
Expand Up @@ -39,14 +39,14 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class WebSocketJsrServerTest
public class WebSocketJakartaServerTest
{
private Server server;

@BeforeEach
public void startServer() throws Exception
{
server = WebSocketJsrServer.createServer(0);
server = WebSocketJakartaServer.createServer(0);
server.start();
}

Expand All @@ -59,23 +59,23 @@ public void stopServer() throws Exception
@Test
public void testGetEcho() throws Exception
{
WebSocketContainer javaxWebSocketClient = ContainerProvider.getWebSocketContainer();
javaxWebSocketClient.setDefaultMaxSessionIdleTimeout(2000);
WebSocketContainer jakartaWebSocketClient = ContainerProvider.getWebSocketContainer();
jakartaWebSocketClient.setDefaultMaxSessionIdleTimeout(2000);
try
{
URI wsUri = WSURI.toWebsocket(server.getURI().resolve("/echo"));

TrackingClientEndpoint clientEndpoint = new TrackingClientEndpoint();

Session session = javaxWebSocketClient.connectToServer(clientEndpoint, null, wsUri);
Session session = jakartaWebSocketClient.connectToServer(clientEndpoint, null, wsUri);
session.getBasicRemote().sendText("Hello World");

String response = clientEndpoint.messages.poll(2, SECONDS);
assertThat("Response", response, is("Hello World"));
}
finally
{
LifeCycle.stop(javaxWebSocketClient);
LifeCycle.stop(jakartaWebSocketClient);
}
}

Expand Down
Expand Up @@ -139,7 +139,7 @@ Here is an example, setting the context attribute in code (although you can also
----
WebAppContext context = new WebAppContext();
context.setAttribute("org.eclipse.jetty.containerInitializerOrder",
"org.eclipse.jetty.websocket.jakarta.server.JavaxWebSocketServletContainerInitializer, com.acme.Foo.MySCI, *");
"org.eclipse.jetty.websocket.jakarta.server.JakartaWebSocketServletContainerInitializer, com.acme.Foo.MySCI, *");
----

In this example, we ensure that the `WebSocketServerContainerInitializer` is the very first `ServletContainerInitializer` that is called, followed by MySCI and then any other `ServletContainerInitializer` instances that were discovered but not yet called.
Expand Down
Expand Up @@ -1157,6 +1157,6 @@ In addition, as the feature group includes websocket, you will need to download
|=======================================================================
|Jar |Bundle Symbolic Name |Location
|jakarta.websocket-api |jakarta.websocket-api
|https://repo1.maven.org/maven2/javax/websocket/websocket-api[Maven
|https://repo1.maven.org/maven2/jakarta/websocket/jakarta.websocket-api/[Maven
central]
|=======================================================================
Expand Up @@ -113,12 +113,12 @@ Disable Websocket for a particular webapp:::
This can be a significant impost if your webapp contains a lot of classes and/or jar files.
To completely disable websockets and avoid all setup costs associated with it for a particular webapp, use instead the context attribute `org.eclipse.jetty.containerInitializerExclusionPattern`, described next, which allows you to exclude the websocket ServletContainerInitializer that causes the scanning.
Completely disable Websocket for a particular webapp:::
Set the `org.eclipse.jetty.containerInitializerExclusionPattern` link:#context_attributes[context attribute] to include `org.eclipse.jetty.websocket.jakarta.server.JavaxWebSocketServletContainerInitializer`.
Set the `org.eclipse.jetty.containerInitializerExclusionPattern` link:#context_attributes[context attribute] to include `org.eclipse.jetty.websocket.jakarta.server.JakartaWebSocketServletContainerInitializer`.
Here's an example of doing this in code, although you can do the link:#intro-jetty-configuration-webapps[same in xml]:
+
[source, java, subs="{sub-order}"]
----
WebAppContext context = new WebAppContext();
context.setAttribute("org.eclipse.jetty.containerInitializerExclusionPattern",
"org.eclipse.jetty.websocket.jakarta.server.JavaxWebSocketServletContainerInitializer|com.acme.*");
"org.eclipse.jetty.websocket.jakarta.server.JakartaWebSocketServletContainerInitializer|com.acme.*");
----
4 changes: 2 additions & 2 deletions jetty-home/pom.xml
Expand Up @@ -196,7 +196,7 @@
</configuration>
</execution>
<execution>
<id>copy-lib-javax-websocket-deps</id>
<id>copy-lib-jakarta-websocket-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
Expand All @@ -209,7 +209,7 @@
</configuration>
</execution>
<execution>
<id>copy-lib-javax-websocket-src-deps</id>
<id>copy-lib-jakarta-websocket-src-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
Expand Down
2 changes: 1 addition & 1 deletion jetty-osgi/jetty-osgi-boot/jettyhome/etc/jetty.xml
Expand Up @@ -96,7 +96,7 @@
<Item>org.eclipse.jetty.webapp.JmxConfiguration</Item>
<Item>org.eclipse.jetty.osgi.annotations.AnnotationConfiguration</Item>
<Item>org.eclipse.jetty.websocket.server.config.JettyWebSocketConfiguration</Item>
<Item>JavaxWebSocketConfiguration</Item>
<Item>org.eclipse.jetty.websocket.jakarta.server.config.JakartaWebSocketConfiguration</Item>
<Item>org.eclipse.jetty.osgi.boot.OSGiWebInfConfiguration</Item>
<Item>org.eclipse.jetty.osgi.boot.OSGiMetaInfConfiguration</Item>
</Array>
Expand Down
Expand Up @@ -32,7 +32,7 @@

@ClientEndpoint(
subprotocols = {"chat"})
public class SimpleJavaxWebSocket
public class SimpleJakartaWebSocket
{
private Session session;
public CountDownLatch messageLatch = new CountDownLatch(1);
Expand Down
Expand Up @@ -47,7 +47,7 @@
* Test using websocket in osgi
*/
@RunWith(PaxExam.class)
public class TestJettyOSGiBootWithJavaxWebSocket
public class TestJettyOSGiBootWithJakartaWebSocket
{
private static final String LOG_LEVEL = "WARN";

Expand All @@ -60,7 +60,7 @@ public static Option[] configure()
ArrayList<Option> options = new ArrayList<>();
// options.add(TestOSGiUtil.optionalRemoteDebug());
options.add(CoreOptions.junitBundles());
options.addAll(TestOSGiUtil.configureJettyHomeAndPort(false, "jetty-http-boot-with-javax-websocket.xml"));
options.addAll(TestOSGiUtil.configureJettyHomeAndPort(false, "jetty-http-boot-with-jakarta-websocket.xml"));
options.add(CoreOptions.bootDelegationPackages("org.xml.sax", "org.xml.*", "org.w3c.*", "javax.sql.*", "javax.xml.*", "javax.activation.*"));
options.add(CoreOptions.systemPackages("com.sun.org.apache.xalan.internal.res", "com.sun.org.apache.xml.internal.utils",
"com.sun.org.apache.xml.internal.utils", "com.sun.org.apache.xpath.internal",
Expand Down Expand Up @@ -121,7 +121,7 @@ public void testWebsocket() throws Exception
WebSocketContainer container = ContainerProvider.getWebSocketContainer();
assertNotNull(container);

SimpleJavaxWebSocket socket = new SimpleJavaxWebSocket();
SimpleJakartaWebSocket socket = new SimpleJakartaWebSocket();
URI uri = new URI("ws://127.0.0.1:" + port + "/jakarta.websocket/");
try (Session session = container.connectToServer(socket, uri))
{
Expand Down
Expand Up @@ -30,7 +30,7 @@
* A {@link WebAppContext} is configured by the application of one or more {@link Configuration}
* instances. Typically each implemented Configuration is responsible for an aspect of the
* servlet specification (eg {@link WebXmlConfiguration}, {@link FragmentConfiguration}, etc.)
* or feature (eg {@code JavaxWebSocketConfiguration}, {@code JmxConfiguration} etc.)
* or feature (eg {@code JakartaWebSocketConfiguration}, {@code JmxConfiguration} etc.)
* </p>
* <p>Configuration instances are discovered by the {@link Configurations} class using either the
* {@link ServiceLoader} mechanism or by an explicit call to {@link Configurations#setKnown(String...)}.
Expand Down
Expand Up @@ -39,7 +39,7 @@ public JakartaWebSocketConfiguration()
addDependents("org.eclipse.jetty.annotations.AnnotationConfiguration", WebAppConfiguration.class.getName());
protectAndExpose("org.eclipse.jetty.websocket.servlet."); // For WebSocketUpgradeFilter
protectAndExpose("org.eclipse.jetty.websocket.jakarta.server.config.");
protectAndExpose("JakartaWebSocketClientContainerProvider");
protectAndExpose("org.eclipse.jetty.websocket.jakarta.client.JakartaWebSocketClientContainerProvider");
hide("org.eclipse.jetty.websocket.jakarta.server.internal");
}
}
Expand Up @@ -57,7 +57,7 @@ public static JettyWebSocketServerContainer getContainer(ServletContext servletC

public static JettyWebSocketServerContainer ensureContainer(ServletContext servletContext)
{
ServletContextHandler contextHandler = ServletContextHandler.getServletContextHandler(servletContext, "Javax Websocket");
ServletContextHandler contextHandler = ServletContextHandler.getServletContextHandler(servletContext, "Jakarta Websocket");
if (contextHandler.getServer() == null)
throw new IllegalStateException("Server has not been set on the ServletContextHandler");

Expand Down
Expand Up @@ -34,7 +34,7 @@

import static org.junit.jupiter.api.Assertions.assertTrue;

public class JavaxWebSocketTest
public class JakartaWebSocketTest
{
private static XmlBasedJettyServer server;

Expand Down
Expand Up @@ -32,9 +32,9 @@
import jakarta.websocket.server.ServerEndpoint;

@ServerEndpoint(value = "/jakarta.websocket/", subprotocols = {"chat"})
public class JavaxWebSocketChat
public class JakartaWebSocketChat
{
private static final List<JavaxWebSocketChat> members = new CopyOnWriteArrayList<>();
private static final List<JakartaWebSocketChat> members = new CopyOnWriteArrayList<>();

volatile Session session;
volatile RemoteEndpoint.Async remote;
Expand Down Expand Up @@ -63,10 +63,10 @@ public void onMessage(String data)
return;
}

ListIterator<JavaxWebSocketChat> iter = members.listIterator();
ListIterator<JakartaWebSocketChat> iter = members.listIterator();
while (iter.hasNext())
{
JavaxWebSocketChat member = iter.next();
JakartaWebSocketChat member = iter.next();

// Test if member is now disconnected
if (!member.session.isOpen())
Expand Down

0 comments on commit 8595534

Please sign in to comment.