Skip to content

Commit

Permalink
[#1802] Switch pax-web-extender-war from javax to jakarta
Browse files Browse the repository at this point in the history
  • Loading branch information
grgrzybek committed Jun 13, 2023
1 parent 7f2320d commit c0a6a28
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 169 deletions.
47 changes: 31 additions & 16 deletions pax-web-extender-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,27 @@
<instructions>
<Bundle-Activator>org.ops4j.pax.web.extender.war.internal.Activator</Bundle-Activator>
<Import-Package>
<!-- ranges indicate Servlet API 3.1+ (JavaEE 7+) -->
javax.servlet;version="[3.1,5)",
javax.servlet.descriptor;version="[3.1,5)",
javax.servlet.annotation;version="[3.1,5)",
javax.servlet.http;version="[3.1,5)",
<!-- ranges indicate Servlet API 6.0+ (JakartaEE 10+) -->
jakarta.servlet;version="[6,7)",
jakarta.servlet.annotation;version="[6,7)",
jakarta.servlet.descriptor;version="[6,7)",
jakarta.servlet.http;version="[6,7)",

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

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

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

<!-- from pax-web-api -->
org.ops4j.pax.web.service;version="${pax-web.osgi.version}",
org.ops4j.pax.web.service.http;version="${pax-web.osgi.version}",
org.ops4j.pax.web.utils;version="${pax-web.osgi.version}",

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

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

<!-- from pax-web-tomcat-common / tomcat-api -->
org.apache.tomcat;version="${dependency.org.apache.tomcat}",
Expand Down Expand Up @@ -129,13 +129,18 @@
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.servlet</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.utils</artifactId>
</dependency>

<!-- JavaEE -->
<!-- JakartaEE -->

<dependency>
<groupId>jakarta.annotation</groupId>
Expand All @@ -157,7 +162,7 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
<scope>test</scope>
</dependency>

Expand All @@ -181,8 +186,18 @@
<!-- Testing -->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public Extension createExtension(Bundle bundle, Runnable cleanup) {
return null;
}

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

Expand Down Expand Up @@ -707,7 +707,7 @@ public boolean skipJarScanning(String jarName) {
* <p>The {@link Extension} representing a "WAB" (Web Application Bundle) which (according to 128.3 Web Application
* Bundle) is a {@link Bundle} with {@code Web-ContextPath} manifest header.</p>
*
* <p>No other constraints are put onto the WAB (like visibility of {@link javax.servlet.Servlet} class or the
* <p>No other constraints are put onto the WAB (like visibility of {@link jakarta.servlet.Servlet} class or the
* content). Also it doesn't matter whether the bundle originally contained the required manifest header or
* the header was applied using some URL handler (like pax-url-war).</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import org.slf4j.LoggerFactory;

/**
* <p>This class adjusts {@link org.osgi.service.http.context.ServletContextHelper} from the Whiteboard specification
* <p>This class adjusts {@link org.osgi.service.servlet.context.ServletContextHelper} from the Whiteboard specification
* (chapter 140) to OSGi CMPN Web Applications specification (chapter 128). The most important thing is that
* {@link org.osgi.service.http.context.ServletContextHelper#getResource} uses {@link Bundle#getEntry} method
* {@link org.osgi.service.servlet.context.ServletContextHelper#getResource} uses {@link Bundle#getEntry} method
* which doesn't consider fragments, while chapter "128.3.5 Static Content" says:<blockquote>
* For a WAB, these resources must be found according to the findEntries method, this method includes fragments.
* </blockquote></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
import javax.servlet.descriptor.JspConfigDescriptor;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterRegistration;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.Servlet;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRegistration;
import jakarta.servlet.SessionCookieConfig;
import jakarta.servlet.SessionTrackingMode;
import jakarta.servlet.descriptor.JspConfigDescriptor;

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

@Override
public Servlet getServlet(String name) {
return null;
}

@Override
public Enumeration<Servlet> getServlets() {
return null;
}

@Override
public Enumeration<String> getServletNames() {
return null;
}

@Override
public void log(String msg) {

}

@Override
public void log(Exception exception, String msg) {

}

@Override
public void log(String message, Throwable throwable) {

Expand Down
Loading

0 comments on commit c0a6a28

Please sign in to comment.