Skip to content

Commit 7c2350b

Browse files
committed
[#1802] Switch pax-web-extender-war from javax to jakarta
1 parent 9ae2cc8 commit 7c2350b

File tree

7 files changed

+165
-169
lines changed

7 files changed

+165
-169
lines changed

pax-web-extender-war/pom.xml

+31-16
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,27 @@
4343
<instructions>
4444
<Bundle-Activator>org.ops4j.pax.web.extender.war.internal.Activator</Bundle-Activator>
4545
<Import-Package>
46-
<!-- ranges indicate Servlet API 3.1+ (JavaEE 7+) -->
47-
javax.servlet;version="[3.1,5)",
48-
javax.servlet.descriptor;version="[3.1,5)",
49-
javax.servlet.annotation;version="[3.1,5)",
50-
javax.servlet.http;version="[3.1,5)",
46+
<!-- ranges indicate Servlet API 6.0+ (JakartaEE 10+) -->
47+
jakarta.servlet;version="[6,7)",
48+
jakarta.servlet.annotation;version="[6,7)",
49+
jakarta.servlet.descriptor;version="[6,7)",
50+
jakarta.servlet.http;version="[6,7)",
5151

5252
<!-- for annotation scanning on listeners, servlets and filters -->
53-
javax.annotation;version="[1.3,2)",
54-
javax.annotation.security;version="[1.3,2)",
53+
jakarta.annotation;version="[2,3)",
54+
jakarta.annotation.security;version="[2,3)",
5555

56-
<!-- ranges indicate we can work with OSGi Core R6+ -->
57-
org.osgi.framework;version="[1.8,2)",
56+
<!-- OSGi Core R8+ -->
57+
org.osgi.framework;version="[1.10,2)",
5858
org.osgi.framework.wiring;version="[1.2,2)",
5959
org.osgi.util.tracker;version="[1.5,2)",
6060

6161
<!-- OSGi cmpn -->
62-
org.osgi.service.http;version="[1.2,2)",
63-
org.osgi.service.http.context;version="[1.1,2)",
62+
org.osgi.service.servlet.context;version="[2,3)",
6463

6564
<!-- from pax-web-api -->
6665
org.ops4j.pax.web.service;version="${pax-web.osgi.version}",
66+
org.ops4j.pax.web.service.http;version="${pax-web.osgi.version}",
6767
org.ops4j.pax.web.utils;version="${pax-web.osgi.version}",
6868

6969
<!-- from pax-web-spi -->
@@ -79,7 +79,7 @@
7979
org.ops4j.pax.web.service.spi.util;version="${pax-web.osgi.version}",
8080

8181
<!-- from pax-logging-api -->
82-
org.slf4j;version="[1.7,2)",
82+
org.slf4j;version="[2,3)",
8383

8484
<!-- from pax-web-tomcat-common / tomcat-api -->
8585
org.apache.tomcat;version="${dependency.org.apache.tomcat}",
@@ -129,13 +129,18 @@
129129
<artifactId>osgi.core</artifactId>
130130
<scope>provided</scope>
131131
</dependency>
132+
<dependency>
133+
<groupId>org.osgi</groupId>
134+
<artifactId>org.osgi.service.servlet</artifactId>
135+
<scope>provided</scope>
136+
</dependency>
132137

133138
<dependency>
134139
<groupId>org.apache.felix</groupId>
135140
<artifactId>org.apache.felix.utils</artifactId>
136141
</dependency>
137142

138-
<!-- JavaEE -->
143+
<!-- JakartaEE -->
139144

140145
<dependency>
141146
<groupId>jakarta.annotation</groupId>
@@ -157,7 +162,7 @@
157162
</dependency>
158163
<dependency>
159164
<groupId>org.apache.logging.log4j</groupId>
160-
<artifactId>log4j-slf4j-impl</artifactId>
165+
<artifactId>log4j-slf4j2-impl</artifactId>
161166
<scope>test</scope>
162167
</dependency>
163168

@@ -181,8 +186,18 @@
181186
<!-- Testing -->
182187

183188
<dependency>
184-
<groupId>junit</groupId>
185-
<artifactId>junit</artifactId>
189+
<groupId>org.junit.jupiter</groupId>
190+
<artifactId>junit-jupiter-api</artifactId>
191+
<scope>test</scope>
192+
</dependency>
193+
<dependency>
194+
<groupId>org.junit.jupiter</groupId>
195+
<artifactId>junit-jupiter-engine</artifactId>
196+
<scope>test</scope>
197+
</dependency>
198+
<dependency>
199+
<groupId>org.assertj</groupId>
200+
<artifactId>assertj-core</artifactId>
186201
<scope>test</scope>
187202
</dependency>
188203
<dependency>

pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WarExtenderContext.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public Extension createExtension(Bundle bundle, Runnable cleanup) {
343343
return null;
344344
}
345345

346-
// before Pax Web 8 there was a check whether the bundle can see javax.servlet.Servlet class. But
346+
// before Pax Web 8 there was a check whether the bundle can see jakarta.servlet.Servlet class. But
347347
// that's too harsh requirement, because a WAR can be used to serve static content only, without
348348
// registration of any servlet (at least explicitly - as the "default" server should be added for free)
349349

@@ -707,7 +707,7 @@ public boolean skipJarScanning(String jarName) {
707707
* <p>The {@link Extension} representing a "WAB" (Web Application Bundle) which (according to 128.3 Web Application
708708
* Bundle) is a {@link Bundle} with {@code Web-ContextPath} manifest header.</p>
709709
*
710-
* <p>No other constraints are put onto the WAB (like visibility of {@link javax.servlet.Servlet} class or the
710+
* <p>No other constraints are put onto the WAB (like visibility of {@link jakarta.servlet.Servlet} class or the
711711
* content). Also it doesn't matter whether the bundle originally contained the required manifest header or
712712
* the header was applied using some URL handler (like pax-url-war).</p>
713713
*

pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebApplicationHelper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
import org.slf4j.LoggerFactory;
3030

3131
/**
32-
* <p>This class adjusts {@link org.osgi.service.http.context.ServletContextHelper} from the Whiteboard specification
32+
* <p>This class adjusts {@link org.osgi.service.servlet.context.ServletContextHelper} from the Whiteboard specification
3333
* (chapter 140) to OSGi CMPN Web Applications specification (chapter 128). The most important thing is that
34-
* {@link org.osgi.service.http.context.ServletContextHelper#getResource} uses {@link Bundle#getEntry} method
34+
* {@link org.osgi.service.servlet.context.ServletContextHelper#getResource} uses {@link Bundle#getEntry} method
3535
* which doesn't consider fragments, while chapter "128.3.5 Static Content" says:<blockquote>
3636
* For a WAB, these resources must be found according to the findEntries method, this method includes fragments.
3737
* </blockquote></p>

pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/AttributeCollectingServletContext.java

+10-30
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
import java.util.HashMap;
2525
import java.util.Map;
2626
import java.util.Set;
27-
import javax.servlet.Filter;
28-
import javax.servlet.FilterRegistration;
29-
import javax.servlet.RequestDispatcher;
30-
import javax.servlet.Servlet;
31-
import javax.servlet.ServletContext;
32-
import javax.servlet.ServletException;
33-
import javax.servlet.ServletRegistration;
34-
import javax.servlet.SessionCookieConfig;
35-
import javax.servlet.SessionTrackingMode;
36-
import javax.servlet.descriptor.JspConfigDescriptor;
27+
import jakarta.servlet.Filter;
28+
import jakarta.servlet.FilterRegistration;
29+
import jakarta.servlet.RequestDispatcher;
30+
import jakarta.servlet.Servlet;
31+
import jakarta.servlet.ServletContext;
32+
import jakarta.servlet.ServletException;
33+
import jakarta.servlet.ServletRegistration;
34+
import jakarta.servlet.SessionCookieConfig;
35+
import jakarta.servlet.SessionTrackingMode;
36+
import jakarta.servlet.descriptor.JspConfigDescriptor;
3737

3838
/**
3939
* Trivial context that can be passed to methods which populate it with attributes (like during web fragment parsing)
@@ -102,31 +102,11 @@ public RequestDispatcher getNamedDispatcher(String name) {
102102
return null;
103103
}
104104

105-
@Override
106-
public Servlet getServlet(String name) {
107-
return null;
108-
}
109-
110-
@Override
111-
public Enumeration<Servlet> getServlets() {
112-
return null;
113-
}
114-
115-
@Override
116-
public Enumeration<String> getServletNames() {
117-
return null;
118-
}
119-
120105
@Override
121106
public void log(String msg) {
122107

123108
}
124109

125-
@Override
126-
public void log(Exception exception, String msg) {
127-
128-
}
129-
130110
@Override
131111
public void log(String message, Throwable throwable) {
132112

0 commit comments

Comments
 (0)