Skip to content

Commit

Permalink
[#1802] Switch pax-web-jsp from javax to jakarta
Browse files Browse the repository at this point in the history
  • Loading branch information
grgrzybek committed Jun 12, 2023
1 parent fcd1dc1 commit 0acf95f
Show file tree
Hide file tree
Showing 20 changed files with 397 additions and 406 deletions.
9 changes: 2 additions & 7 deletions pax-web-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
org.osgi.framework;version="[1.10,2)",
org.osgi.framework.wiring;version="[1.2,2)",

<!-- OSGi CMPN R8.1 140 Jakarta Servlet packages (formerly known as Whiteboard) -->
<!-- OSGi CMPN R8.1 140 Whiteboard Specification for Jakarta™ Servlet -->
org.osgi.service.servlet.context;version="2.0.0",
org.osgi.service.servlet.runtime;version="2.0.0",
org.osgi.service.servlet.runtime.dto;version="2.0.0",
Expand Down Expand Up @@ -218,11 +218,6 @@
<artifactId>org.osgi.namespace.extender</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.http</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.servlet</artifactId>
Expand Down Expand Up @@ -287,7 +282,7 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${dependency.org.assertj}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public interface PaxWebConstants {
* The only supported {@link jakarta.servlet.ServletContainerInitializer} class that configures WebSocket
* container for Jetty
*/
String DEFAULT_WEBSOCKET_JETTY_SCI_CLASS = "org.eclipse.jetty.websocket.javax.server.config.JavaxWebSocketServletContainerInitializer";
String DEFAULT_WEBSOCKET_JETTY_SCI_CLASS = "org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer";
/**
* The only supported {@link jakarta.servlet.ServletContainerInitializer} class that configures WebSocket
* container for Tomcat
Expand Down Expand Up @@ -280,6 +280,7 @@ public interface PaxWebConstants {
* help us provide nice OSGi-aware discovery mechanism. That's why this context parameter will provide special
* {@link java.util.Map} that can be used when searching for FACELET resources.</p>
*/
// TODO: JakartaEE 10
String CONTEXT_PARAM_PAX_WEB_FACELETS_LIBRARIES = "org.ops4j.pax.web.javax.faces.FACELETS_LIBRARIES";

// --- 3 properties defined in 128.3.4 "Publishing the Servlet Context" (and one Pax Web specific)
Expand All @@ -296,4 +297,9 @@ public interface PaxWebConstants {
/** Context name of the WAB bundle or bundle registering OSGi servlet context (Pax Web addition) */
String SERVICE_PROPERTY_WEB_SERVLETCONTEXT_NAME = "osgi.web.contextname";

/**
* For compatibility purpose (OSGi CMPN 8: {@code org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_SERVICE_CONTEXT_PROPERTY})
*/
String HTTP_SERVICE_CONTEXT_PROPERTY = "osgi.http.whiteboard.context.httpservice";

}
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ void setSessionCookieConfig(String domain, String name, Boolean httpOnly, Boolea
// methods used to register annotated web socket endpoints

/**
* Registers a WebSocket endpoint annotated with {@code @javax.websocket.server.ServerEndpoint}. The actual
* Registers a WebSocket endpoint annotated with {@code @jakarta.websocket.server.ServerEndpoint}. The actual
* object passed may be both an actual instance or a {@link Class} object which will be instantiated when needed.
* @param webSocket
* @param httpContext
Expand All @@ -891,7 +891,7 @@ void setSessionCookieConfig(String domain, String name, Boolean httpOnly, Boolea

/**
* Unregisters a previously registered WebSocket endpoint annotated with
* {@code @javax.websocket.server.ServerEndpoint}
* {@code @jakarta.websocket.server.ServerEndpoint}
* @param webSocket
* @param httpContext
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* namespace.</p>
*
* <p>Original package is {@code org.osgi.service.http}. There's no new equivalen of this package and users
* are encouraged to move to <a href="https://docs.osgi.org/specification/osgi.cmpn/8.1.0/service.servlet.html">Jakarta Servlet Specificaiton</a> (formerly known as
* <em>Whiteboard specification</em>).</p>
* are encouraged to move to <a href="https://docs.osgi.org/specification/osgi.cmpn/8.1.0/service.servlet.html">Whiteboard Specification for Jakarta™ Servlet</a>.</p>
*/
package org.ops4j.pax.web.service.http;
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@
* <p>On purpose, we don't allow registration of other objects that usually can be passed (by means of
* {@link jakarta.servlet.annotation.HandlesTypes} annotation on a {@link jakarta.servlet.ServletContainerInitializer}
* related to WebSockets) by users. Only annontated classes or actual instances are handled and we don't support:<ul>
* <li>{@code javax.websocket.server.ServerApplicationConfig}</li>
* <li>{@code javax.websocket.Endpoint}</li>
* <li>{@code jakarta.websocket.server.ServerApplicationConfig}</li>
* <li>{@code jakarta.websocket.Endpoint}</li>
* </ul></p>
*/
public interface WebSocketMapping extends ContextRelated {

/**
* Returns a {@link Class} of the WebSocket endpoint that should be annotated with
* {@code @javax.websocket.server.ServerEndpoint} annotation. If both the
* {@code @jakarta.websocket.server.ServerEndpoint} annotation. If both the
* object ({@link #getWebSocketAnnotatedEndpoint()}) and the class is specified, the class takes precedence.
* @return
*/
Class<?> getWebSocketClass();

/**
* Returns an instance of a class annotated with {@code @javax.websocket.server.ServerEndpoint}. If both the
* Returns an instance of a class annotated with {@code @jakarta.websocket.server.ServerEndpoint}. If both the
* object and the class ({@link #getWebSocketClass()}) is specified, the class takes precedence.
* @return
*/
Expand Down
147 changes: 64 additions & 83 deletions pax-web-jsp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,42 +44,41 @@
<configuration>
<instructions>
<Import-Package>
<!-- ranges indicate Servlet API 3.1+ (JavaEE 7+) -->
javax.servlet;version="[3.1,5)",
javax.servlet.annotation;version="[3.1,5)",
javax.servlet.descriptor;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)",

<!-- JSP API (also exported from pax-web-jsp - this bundle) -->
javax.servlet.jsp;version="2.3",
javax.servlet.jsp.el;version="2.3",
javax.servlet.jsp.tagext;version="2.3",
jakarta.servlet.jsp;version="${dependency.jakarta.servlet.jsp-api}",
jakarta.servlet.jsp.el;version="${dependency.jakarta.servlet.jsp-api}",
jakarta.servlet.jsp.tagext;version="${dependency.jakarta.servlet.jsp-api}",

<!-- JSTL API (also exported from pax-web-jsp - this bundle) -->
javax.servlet.jsp.jstl.core;version="${dependency.jakarta.servlet.jsp.jstl-api}",
javax.servlet.jsp.jstl.fmt;version="${dependency.jakarta.servlet.jsp.jstl-api}",
javax.servlet.jsp.jstl.sql;version="${dependency.jakarta.servlet.jsp.jstl-api}",
javax.servlet.jsp.jstl.tlv;version="${dependency.jakarta.servlet.jsp.jstl-api}",
jakarta.servlet.jsp.jstl.core;version="${dependency.jakarta.servlet.jsp.jstl-api}",
jakarta.servlet.jsp.jstl.fmt;version="${dependency.jakarta.servlet.jsp.jstl-api}",
jakarta.servlet.jsp.jstl.sql;version="${dependency.jakarta.servlet.jsp.jstl-api}",
jakarta.servlet.jsp.jstl.tlv;version="${dependency.jakarta.servlet.jsp.jstl-api}",

<!-- EL API (only imported - from jakarta.el:jakarta.el-api) -->
javax.el;version="[3.0,4)",
jakarta.el;version="[5.0,6)",

<!-- ranges indicate we can work with OSGi Core R6+ -->
org.osgi.framework;version="[1.8,2)",
<!-- OSGi Core R8+ -->
org.osgi.dto;version="[1.1,2)",
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)",

<!-- from pax-web -->
org.ops4j.pax.web.utils;version="${pax-web.osgi.version}",
org.ops4j.pax.web.service.http;version="${pax-web.osgi.version}",
org.ops4j.pax.web.service.spi.model;version="${pax-web.osgi.version}",
org.ops4j.pax.web.service.spi.servlet;version="${pax-web.osgi.version}",
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)",
org.apache.juli.logging,

<!-- packages required by Jasper/EL implementation and exported from pax-web-tomcat-common -->
Expand All @@ -104,7 +103,7 @@
org.eclipse.jdt.internal.compiler.problem,

<!-- other standard packages -->
javax.annotation,
jakarta.annotation,
javax.naming,
javax.sql;resolution:=optional,
javax.xml.parsers,
Expand Down Expand Up @@ -135,31 +134,17 @@
re-export JSP API - from mvn:org.apache.tomcat/tomcat-jsp-api
(instead of from mvn:jakarta.servlet.jsp/jakarta.servlet.jsp-api)
-->
javax.servlet.jsp;version="2.3",
javax.servlet.jsp.el;version="2.3",
javax.servlet.jsp.tagext;version="2.3",
jakarta.servlet.jsp;version="${dependency.jakarta.servlet.jsp-api}",
jakarta.servlet.jsp.el;version="${dependency.jakarta.servlet.jsp-api}",
jakarta.servlet.jsp.tagext;version="${dependency.jakarta.servlet.jsp-api}",

<!-- re-export JSTL API from mvn:jakarta.servlet.jsp.jstl/jakarta.servlet.jsp.jstl-api -->
javax.servlet.jsp.jstl.core;version="${dependency.jakarta.servlet.jsp.jstl-api}",
javax.servlet.jsp.jstl.fmt;version="${dependency.jakarta.servlet.jsp.jstl-api}",
javax.servlet.jsp.jstl.sql;version="${dependency.jakarta.servlet.jsp.jstl-api}",
javax.servlet.jsp.jstl.tlv;version="${dependency.jakarta.servlet.jsp.jstl-api}",
jakarta.servlet.jsp.jstl.core;version="${dependency.jakarta.servlet.jsp.jstl-api}",
jakarta.servlet.jsp.jstl.fmt;version="${dependency.jakarta.servlet.jsp.jstl-api}",
jakarta.servlet.jsp.jstl.sql;version="${dependency.jakarta.servlet.jsp.jstl-api}",
jakarta.servlet.jsp.jstl.tlv;version="${dependency.jakarta.servlet.jsp.jstl-api}",

<!--
re-export EL Impl - from mvn:org.apache.tomcat/tomcat-jasper-el
for broader picture:
- org.apache.tomcat/tomcat-el-api/9.0.29 has OSGi manifest, but doesn't specify versions
- org.apache.tomcat/tomcat-el-api/8.5.49 is not an OSGi bundle
- org.apache.tomcat/tomcat-jasper-el/9.0.29 has OSGi manifest, but doesn't specify versions
- org.apache.tomcat/tomcat-jasper-el/8.5.49 is not an OSGi bundle
- org.glassfish.web/javax.el/2.2.6 (EL 2.2) exports com.sun.el.* and imports javax.el
at version 2.2
- org.glassfish.web/el-impl/2.2 (EL 2.2) exports com.sun.el.* and imports javax.el
at version 2.2
- org.glassfish/javax.el/3.0.0 (EL 3.0) exports com.sun.el.* and imports javax.el
at version 3.0.0
version of implementation should be not the same as the version of specification
-->
<!-- re-export EL Impl - from mvn:org.apache.tomcat/tomcat-jasper-el -->
org.apache.el;version="${dependency.org.apache.tomcat}",
org.apache.el.lang;version="${dependency.org.apache.tomcat}",
org.apache.el.parser;version="${dependency.org.apache.tomcat}",
Expand All @@ -185,6 +170,7 @@
impl in 2010 (http://svn.apache.org/viewvc?view=revision&revision=1026635),
so we hopefuly clear the confusion in pax-web-jsp
-->
<!-- TODO: JakartaEE 10 -->
org.apache.taglibs.standard;version="1.2",
org.apache.taglibs.standard.functions;version="1.2",
org.apache.taglibs.standard.tag.common.core;version="1.2",
Expand All @@ -197,14 +183,11 @@
org.apache.taglibs.standard.tag.rt.xml;version="1.2",
org.apache.taglibs.standard.tei;version="1.2",
org.apache.taglibs.standard.tlv;version="1.2",
org.apache.taglibs.standard.util;version="1.2",

<!-- don't re-export JSTL Impl from mvn:org.apache.taglibs/taglibs-standard-compat -->
!org.apache.taglibs.standard.tag.compat.*,
<!-- don't re-export JSTL Impl from mvn:org.apache.taglibs/taglibs-standard-jstlel -->
!org.apache.taglibs.standard.lang.*,
!org.apache.taglibs.standard.tag.el.*,
!org.apache.taglibs.standard.tlv.el
!org.apache.taglibs.standard.tlv
</Export-Package>
<Private-Package>
<!-- resources from mvn:org.apache.tomcat/tomcat-jasper which are not exported (no *.class there) -->
Expand All @@ -221,8 +204,9 @@
</Embed-Dependency>
<_nouses>true</_nouses>
<_contract>!*</_contract>
<!-- TODO: JakartaEE 10 -->
<Provide-Capability><![CDATA[
osgi.contract;osgi.contract=JavaJSP;uses:="javax.servlet.jsp,javax.servlet.jsp.el,javax.servlet.jsp.tagext";
osgi.contract;osgi.contract=JavaJSP;uses:="jakarta.servlet.jsp,jakarta.servlet.jsp.el,jakarta.servlet.jsp.tagext";
version:List<Version>="2.3,2.2,2.1,2"
]]></Provide-Capability>
</instructions>
Expand Down Expand Up @@ -271,16 +255,21 @@
<scope>provided</scope>
</dependency>

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

<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<!--
This dependency is used instead of jakarta.servlet/jakarta.servlet-api to take javax.servlet.resources
This dependency is used instead of jakarta.servlet/jakarta.servlet-api to take jakarta.servlet.resources
package with XSDs/DTDs into pax-web-jsp
-->
<groupId>org.apache.tomcat</groupId>
Expand All @@ -289,11 +278,11 @@
</dependency>
<dependency>
<!--
This dependency is used instead of jakarta.servlet.jsp/jakarta.servlet.jsp-api to take javax.servlet.jsp.resources
This dependency is used instead of jakarta.servlet.jsp/jakarta.servlet.jsp-api to take jakarta.servlet.jsp.resources
package with XSDs/DTDs into pax-web-jsp and re-export these packages from pax-web-jsp:
- javax.servlet.jsp
- javax.servlet.jsp.el
- javax.servlet.jsp.tagext
- jakarta.servlet.jsp
- jakarta.servlet.jsp.el
- jakarta.servlet.jsp.tagext
-->
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jsp-api</artifactId>
Expand All @@ -304,10 +293,10 @@
This dependency provides packages to re-export from pax-web-jsp. While jakarta.servlet-api and
jakarta.servlet.jsp-api can't be used (because they contain no resources), with JSTL we can use
jakarta.servlet.jsp.jstl-api - also because there's no analogous org.apache.tomcat JAR.
- javax.servlet.jsp.jstl.core
- javax.servlet.jsp.jstl.fmt
- javax.servlet.jsp.jstl.sql
- javax.servlet.jsp.jstl.tlv
- jakarta.servlet.jsp.jstl.core
- jakarta.servlet.jsp.jstl.fmt
- jakarta.servlet.jsp.jstl.sql
- jakarta.servlet.jsp.jstl.tlv
-->
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
Expand Down Expand Up @@ -360,7 +349,9 @@

<dependency>
<!--
This dependency (JSTL implementation) provides packages to re-export from pax-web-jsp:
This dependency (JSTL implementation) provides packages to re-export from pax-web-jsp. for JakartaEE8
and earlier, the implementation was org.apache.taglibs:taglibs-standard-impl, but even if now
it is org.glassfish.web:jakarta.servlet.jsp.jstl, the package is still org.apache.taglibs.*
- org.apache.taglibs.standard
- org.apache.taglibs.standard.functions
- org.apache.taglibs.standard.resources (resources only)
Expand All @@ -374,10 +365,9 @@
- org.apache.taglibs.standard.tag.rt.xml
- org.apache.taglibs.standard.tei
- org.apache.taglibs.standard.tlv
- org.apache.taglibs.standard.util
-->
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -436,7 +426,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 @@ -449,10 +439,20 @@
</dependency>

<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>
<version>${dependency.org.assertj}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -461,23 +461,4 @@

</dependencies>

<profiles>
<profile>
<id>jdk11</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<dependencies>

<!-- JavaEE / JakartaEE -->

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>

</dependencies>
</profile>
</profiles>

</project>
Loading

0 comments on commit 0acf95f

Please sign in to comment.