Skip to content

Commit 6a59d8f

Browse files
authored
FELIX-6702 : Make Jetty bundles EE version neutral
Jetty bundle * org.apache.felix.jakarta.ee9.websocket.enable -> org.apache.felix.jakarta.websocket.enable * org.apache.felix.jetty.ee9.websocket.enable -> org.apache.felix.jetty.websocket.enable Jetty12 bundle * org.apache.felix.jakarta.ee10.websocket.enable -> org.apache.felix.jakarta.websocket.enable * org.apache.felix.jetty.ee10.websocket.enable -> org.apache.felix.jetty.websocket.enable Classifiers: * with-jetty-ee10-websockets -> with-jetty-websockets * with-jakarta-ee10-websockets -> with-jakarta-websockets Updated unit tests and README.md to reflect these changes.
1 parent 517f9a0 commit 6a59d8f

File tree

17 files changed

+131
-133
lines changed

17 files changed

+131
-133
lines changed

http/README.md

Lines changed: 57 additions & 59 deletions
Large diffs are not rendered by default.

http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -484,16 +484,16 @@ public ObjectClassDefinition getObjectClassDefinition( String id, String locale
484484
CustomRequestLog.NCSA_FORMAT,
485485
bundle.getBundleContext().getProperty(JettyConfig.FELIX_HTTP_REQUEST_LOG_FORMAT)));
486486

487-
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JAKARTA_EE9_WEBSOCKET_ENABLE,
488-
"Enable Jakarta EE9 standard WebSocket support",
489-
"Whether to enable jakarta EE9 standard WebSocket support. Default is false.",
487+
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JAKARTA_WEBSOCKET_ENABLE,
488+
"Enable Jakarta standard WebSocket support",
489+
"Whether to enable jakarta standard WebSocket support. Default is false.",
490490
false,
491-
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JAKARTA_EE9_WEBSOCKET_ENABLE)));
492-
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_EE9_WEBSOCKET_ENABLE,
493-
"Enable Jetty specific EE9 WebSocket support",
491+
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JAKARTA_WEBSOCKET_ENABLE)));
492+
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_WEBSOCKET_ENABLE,
493+
"Enable Jetty specific WebSocket support",
494494
"Whether to enable jetty specific WebSocket support. Default is false.",
495495
false,
496-
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_EE9_WEBSOCKET_ENABLE)));
496+
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_WEBSOCKET_ENABLE)));
497497

498498
return new ObjectClassDefinition()
499499
{

http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ public final class JettyConfig
268268
/** Felix specific property to specify the default protocol when negotiation fails */
269269
public static final String FELIX_JETTY_ALPN_DEFAULT_PROTOCOL = "org.apache.felix.jetty.alpn.defaultProtocol";
270270

271-
/** Felix specific property to control whether to enable the standard jakarta.websocket EE9 APIs provided by Jakarta WebSocket 2.0 */
272-
public static final String FELIX_JAKARTA_EE9_WEBSOCKET_ENABLE = "org.apache.felix.jakarta.ee9.websocket.enable";
271+
/** Felix specific property to control whether to enable the standard jakarta.websocket APIs provided by Jakarta WebSocket 2.0 */
272+
public static final String FELIX_JAKARTA_WEBSOCKET_ENABLE = "org.apache.felix.jakarta.websocket.enable";
273273

274274
/** Felix specific property to control whether to enable they Jetty-specific WebSocket APIs */
275-
public static final String FELIX_JETTY_EE9_WEBSOCKET_ENABLE = "org.apache.felix.jetty.ee9.websocket.enable";
275+
public static final String FELIX_JETTY_WEBSOCKET_ENABLE = "org.apache.felix.jetty.websocket.enable";
276276

277277

278278
private static String validateContextPath(String ctxPath)
@@ -683,18 +683,18 @@ public long getStopTimeout() {
683683

684684
/**
685685
* Returns <code>true</code> if jakarta EE9 websocket is configured to be used (
686-
* {@link #FELIX_JAKARTA_EE9_WEBSOCKET_ENABLE})
686+
* {@link #FELIX_JAKARTA_WEBSOCKET_ENABLE})
687687
*/
688-
public boolean isUseJakartaEE9Websocket() {
689-
return getBooleanProperty(FELIX_JAKARTA_EE9_WEBSOCKET_ENABLE, false);
688+
public boolean isUseJakartaWebsocket() {
689+
return getBooleanProperty(FELIX_JAKARTA_WEBSOCKET_ENABLE, false);
690690
}
691691

692692
/**
693693
* Returns <code>true</code> if jetty websocket is configured to be used (
694694
* {@link #FELIX_JETTY_WEBSOCKET_ENABLE})
695695
*/
696-
public boolean isUseJettyEE9Websocket() {
697-
return getBooleanProperty(FELIX_JETTY_EE9_WEBSOCKET_ENABLE, false);
696+
public boolean isUseJettyWebsocket() {
697+
return getBooleanProperty(FELIX_JETTY_WEBSOCKET_ENABLE, false);
698698
}
699699

700700
public void reset()

http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,12 @@ private void initializeJetty() throws Exception
308308
this.server.setStopTimeout(this.config.getStopTimeout());
309309
}
310310

311-
if (this.config.isUseJettyEE9Websocket()) {
312-
maybeInitializeJettyEE9Websocket(context);
311+
if (this.config.isUseJettyWebsocket()) {
312+
maybeInitializeJettyWebsocket(context);
313313
}
314314

315-
if (this.config.isUseJakartaEE9Websocket()) {
316-
maybeInitializeJakartaEE9Websocket(context);
315+
if (this.config.isUseJakartaWebsocket()) {
316+
maybeInitializeJakartaWebsocket(context);
317317
}
318318

319319
this.server.start();
@@ -488,29 +488,29 @@ private boolean initializeHttps()
488488
}
489489

490490
/**
491-
* Initialize the jakarta EE9 websocket support for the servlet context handler.
491+
* Initialize the jakarta websocket support for the servlet context handler.
492492
* If the optional initializer class is not present then a warning will be logged.
493493
*
494494
* @param handler the sevlet context handler to initialize
495495
*/
496-
private void maybeInitializeJakartaEE9Websocket(ServletContextHandler handler) {
496+
private void maybeInitializeJakartaWebsocket(ServletContextHandler handler) {
497497
if (isClassNameVisible("org.eclipse.jetty.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer")) {
498498
// Ensure that JavaxWebSocketServletContainerInitializer is initialized,
499499
// to setup the ServerContainer for this web application context.
500500
org.eclipse.jetty.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer.configure(handler, null);
501501
} else {
502-
SystemLogger.LOGGER.warn("Failed to initialize jakarta EE9 standard websocket support since the initializer class was not found. "
502+
SystemLogger.LOGGER.warn("Failed to initialize jakarta standard websocket support since the initializer class was not found. "
503503
+ "Check if the websocket-jakarta-server bundle is deployed.");
504504
}
505505
}
506506

507507
/**
508-
* Initialize the jetty EE9 websocket support for the servlet context handler.
508+
* Initialize the jetty websocket support for the servlet context handler.
509509
* If the optional initializer class is not present then a warning will be logged.
510510
*
511511
* @param handler the sevlet context handler to initialize
512512
*/
513-
private void maybeInitializeJettyEE9Websocket(ServletContextHandler handler) {
513+
private void maybeInitializeJettyWebsocket(ServletContextHandler handler) {
514514
if (isClassNameVisible("org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer")) {
515515
// Ensure that JettyWebSocketServletContainerInitializer is initialized,
516516
// to setup the JettyWebSocketServerContainer for this web application context.
@@ -529,12 +529,12 @@ private void maybeInitializeJettyEE9Websocket(ServletContextHandler handler) {
529529
private void maybeStoreWebSocketContainerAttributes(ServletContextHandler context) {
530530
// when the server is started, retrieve the container attribute and
531531
// set it on the shared servlet context once available
532-
if (this.config.isUseJettyEE9Websocket() &&
532+
if (this.config.isUseJettyWebsocket() &&
533533
isClassNameVisible("org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer")) {
534534
String attribute = org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer.JETTY_WEBSOCKET_CONTAINER_ATTRIBUTE;
535535
this.controller.setAttributeSharedServletContext(attribute, context.getServletContext().getAttribute(attribute));
536536
}
537-
if (this.config.isUseJakartaEE9Websocket() &&
537+
if (this.config.isUseJakartaWebsocket() &&
538538
isClassNameVisible("org.eclipse.jetty.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer")) {
539539
String attribute = org.eclipse.jetty.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer.ATTR_JAKARTA_SERVER_CONTAINER;
540540
this.controller.setAttributeSharedServletContext(attribute, context.getServletContext().getAttribute(attribute));

http/jetty/src/test/java/org/apache/felix/http/jetty/it/JakartaEE9SpecificWebsocketIT.java renamed to http/jetty/src/test/java/org/apache/felix/http/jetty/it/JakartaSpecificWebsocketIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
*/
6161
@RunWith(PaxExam.class)
6262
@ExamReactorStrategy(PerClass.class)
63-
public class JakartaEE9SpecificWebsocketIT extends AbstractJettyTestSupport {
63+
public class JakartaSpecificWebsocketIT extends AbstractJettyTestSupport {
6464

6565
@Inject
6666
protected BundleContext bundleContext;
@@ -91,7 +91,7 @@ protected Option[] additionalOptions() throws IOException {
9191
protected Option felixHttpConfig(int httpPort) {
9292
return newConfiguration("org.apache.felix.http")
9393
.put("org.osgi.service.http.port", httpPort)
94-
.put("org.apache.felix.jakarta.ee9.websocket.enable", true)
94+
.put("org.apache.felix.jakarta.websocket.enable", true)
9595
.asOption();
9696
}
9797

http/jetty/src/test/java/org/apache/felix/http/jetty/it/JettyEE9SpecificWebsocketIT.java renamed to http/jetty/src/test/java/org/apache/felix/http/jetty/it/JettySpecificWebsocketIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
*/
6363
@RunWith(PaxExam.class)
6464
@ExamReactorStrategy(PerClass.class)
65-
public class JettyEE9SpecificWebsocketIT extends AbstractJettyTestSupport {
65+
public class JettySpecificWebsocketIT extends AbstractJettyTestSupport {
6666

6767
@Inject
6868
protected BundleContext bundleContext;
@@ -95,7 +95,7 @@ protected Option[] additionalOptions() throws IOException {
9595
protected Option felixHttpConfig(int httpPort) {
9696
return newConfiguration("org.apache.felix.http")
9797
.put("org.osgi.service.http.port", httpPort)
98-
.put("org.apache.felix.jetty.ee9.websocket.enable", true)
98+
.put("org.apache.felix.jetty.websocket.enable", true)
9999
.asOption();
100100
}
101101

http/jetty/src/test/java/org/apache/felix/http/jetty/it/MissingWebsocketDependenciesIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public class MissingWebsocketDependenciesIT extends AbstractJettyTestSupport {
5050
protected Option felixHttpConfig(int httpPort) {
5151
return newConfiguration("org.apache.felix.http")
5252
.put("org.osgi.service.http.port", httpPort)
53-
.put("org.apache.felix.jetty.ee9.websocket.enable", true)
54-
.put("org.apache.felix.jakarta.ee9.websocket.enable", true)
53+
.put("org.apache.felix.jetty.websocket.enable", true)
54+
.put("org.apache.felix.jakarta.websocket.enable", true)
5555
.asOption();
5656
}
5757

@@ -69,7 +69,7 @@ public void testMissingDepencencyWarningLogs() throws Exception {
6969

7070
assertTrue(containsString(logFile, "org.apache.felix.http.jetty[org.apache.felix.http] : Failed to initialize jetty specific websocket "
7171
+ "support since the initializer class was not found. Check if the websocket-jetty-server bundle is deployed."));
72-
assertTrue(containsString(logFile, "org.apache.felix.http.jetty[org.apache.felix.http] : Failed to initialize jakarta EE9 standard websocket"
72+
assertTrue(containsString(logFile, "org.apache.felix.http.jetty[org.apache.felix.http] : Failed to initialize jakarta standard websocket"
7373
+ " support since the initializer class was not found. Check if the websocket-jakarta-server bundle is deployed."));
7474
}
7575

http/jetty12/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,12 @@
336336
</configuration>
337337
</execution>
338338
<execution>
339-
<id>with-jetty-ee10-websockets</id>
339+
<id>with-jetty-websockets</id>
340340
<goals>
341341
<goal>bundle</goal>
342342
</goals>
343343
<configuration>
344-
<classifier>with-jetty-ee10-websockets</classifier>
344+
<classifier>with-jetty-websockets</classifier>
345345
<instructions>
346346
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
347347
<Bundle-Version>${project.version}</Bundle-Version>
@@ -442,12 +442,12 @@
442442
</configuration>
443443
</execution>
444444
<execution>
445-
<id>with-jakarta-ee10-websockets</id>
445+
<id>with-jakarta-websockets</id>
446446
<goals>
447447
<goal>bundle</goal>
448448
</goals>
449449
<configuration>
450-
<classifier>with-jakarta-ee10-websockets</classifier>
450+
<classifier>with-jakarta-websockets</classifier>
451451
<instructions>
452452
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
453453
<Bundle-Version>${project.version}</Bundle-Version>

http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -490,16 +490,16 @@ public ObjectClassDefinition getObjectClassDefinition( String id, String locale
490490
CustomRequestLog.NCSA_FORMAT,
491491
bundle.getBundleContext().getProperty(JettyConfig.FELIX_HTTP_REQUEST_LOG_FORMAT)));
492492

493-
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JAKARTA_EE10_WEBSOCKET_ENABLE,
494-
"Enable Jakarta EE10 standard WebSocket support",
495-
"Whether to enable jakarta EE10 standard WebSocket support. Default is false.",
493+
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JAKARTA_WEBSOCKET_ENABLE,
494+
"Enable Jakarta standard WebSocket support",
495+
"Whether to enable jakarta standard WebSocket support. Default is false.",
496496
false,
497-
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JAKARTA_EE10_WEBSOCKET_ENABLE)));
498-
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_EE10_WEBSOCKET_ENABLE,
499-
"Enable Jetty EE10 specific WebSocket support",
500-
"Whether to enable jetty EE10 specific WebSocket support. Default is false.",
497+
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JAKARTA_WEBSOCKET_ENABLE)));
498+
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_WEBSOCKET_ENABLE,
499+
"Enable Jetty specific WebSocket support",
500+
"Whether to enable jetty specific WebSocket support. Default is false.",
501501
false,
502-
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_EE10_WEBSOCKET_ENABLE)));
502+
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_WEBSOCKET_ENABLE)));
503503
return new ObjectClassDefinition()
504504
{
505505

http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,11 @@ public final class JettyConfig
271271
/** Felix specific property to specify the default protocol when negotiation fails */
272272
public static final String FELIX_JETTY_ALPN_DEFAULT_PROTOCOL = "org.apache.felix.jetty.alpn.defaultProtocol";
273273

274-
/** Felix specific property to control whether to enable the standard jakarta.websocket EE10 APIs provided by Jakarta WebSocket 2.1 */
275-
public static final String FELIX_JAKARTA_EE10_WEBSOCKET_ENABLE = "org.apache.felix.jakarta.ee10.websocket.enable";
274+
/** Felix specific property to control whether to enable the standard jakarta.websocket APIs provided by Jakarta WebSocket 2.1 */
275+
public static final String FELIX_JAKARTA_WEBSOCKET_ENABLE = "org.apache.felix.jakarta.websocket.enable";
276276

277-
/** Felix specific property to control whether to enable they Jetty-specific EE10 WebSocket APIs */
278-
public static final String FELIX_JETTY_EE10_WEBSOCKET_ENABLE = "org.apache.felix.jetty.ee10.websocket.enable";
277+
/** Felix specific property to control whether to enable they Jetty-specific WebSocket APIs */
278+
public static final String FELIX_JETTY_WEBSOCKET_ENABLE = "org.apache.felix.jetty.websocket.enable";
279279

280280
private static String validateContextPath(String ctxPath)
281281
{
@@ -684,19 +684,19 @@ public long getStopTimeout() {
684684
}
685685

686686
/**
687-
* Returns <code>true</code> if jakarta EE10 websocket is configured to be used (
688-
* {@link #FELIX_JAKARTA_EE10_WEBSOCKET_ENABLE})
687+
* Returns <code>true</code> if jakarta websocket is configured to be used (
688+
* {@link #FELIX_JAKARTA_WEBSOCKET_ENABLE})
689689
*/
690-
public boolean isUseJakartaEE10Websocket() {
691-
return getBooleanProperty(FELIX_JAKARTA_EE10_WEBSOCKET_ENABLE, false);
690+
public boolean isUseJakartaWebsocket() {
691+
return getBooleanProperty(FELIX_JAKARTA_WEBSOCKET_ENABLE, false);
692692
}
693693

694694
/**
695695
* Returns <code>true</code> if jetty websocket is configured to be used (
696-
* {@link #FELIX_JETTY_EE10_WEBSOCKET_ENABLE})
696+
* {@link #FELIX_JETTY_WEBSOCKET_ENABLE})
697697
*/
698-
public boolean isUseJettyEE10Websocket() {
699-
return getBooleanProperty(FELIX_JETTY_EE10_WEBSOCKET_ENABLE, false);
698+
public boolean isUseJettyWebsocket() {
699+
return getBooleanProperty(FELIX_JETTY_WEBSOCKET_ENABLE, false);
700700
}
701701

702702
public void reset()

0 commit comments

Comments
 (0)