Skip to content

Commit cf2bdf5

Browse files
ludochgae-java-bot
authored andcommitted
Update Jasper and add Jakarta EL/JSP API dependencies inside the runtime-shared jars. Add a e2e test class loading checks for Jakarta EE classes in AsyncServlet. Verified that without pom changes, the new test fails.
PiperOrigin-RevId: 817839684 Change-Id: I5fe817fb5a5b9472ea9455365e8907c83f4a2b49
1 parent 50378ee commit cf2bdf5

5 files changed

Lines changed: 88 additions & 91 deletions

File tree

applications/servletasyncapp/src/main/java/AsyncServlet.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,14 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
5959

6060
PrintWriter out = resp.getWriter();
6161
out.println("isAsyncStarted : " + servReq.isAsyncStarted());
62-
// This excecutor should be created in the init phase of AppContextListener.
62+
// This executor should be created in the init phase of AppContextListener.
6363
ThreadPoolExecutor executor =
6464
(ThreadPoolExecutor) req.getServletContext().getAttribute("executor");
6565

6666
executor.execute(new LongProcessingRunnable(asyncContext, millisecs));
67+
68+
checkTagSupportClass();
69+
6770
long endTime = System.currentTimeMillis();
6871
System.out.println(
6972
"AsyncServlet End::Thread Name="
@@ -74,4 +77,20 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
7477
+ (endTime - startTime)
7578
+ " ms.");
7679
}
77-
}
80+
81+
private void checkTagSupportClass() throws RuntimeException {
82+
try {
83+
Class.forName(
84+
"javax.servlet.jsp.tagext.TagSupport",
85+
false,
86+
Thread.currentThread().getContextClassLoader());
87+
Class.forName(
88+
"javax.el.Expression",
89+
false,
90+
Thread.currentThread().getContextClassLoader());
91+
System.out.println("Successfully loaded javax.servlet.jsp.tagext.TagSupport");
92+
} catch (ClassNotFoundException e) {
93+
throw new RuntimeException("Could not load javax.servlet.jsp.tagext.TagSupport: " + e);
94+
}
95+
}
96+
}

applications/servletasyncappjakarta/src/main/java/AsyncServlet.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
import java.io.IOException;
18-
import java.io.PrintWriter;
19-
import java.util.concurrent.ThreadPoolExecutor;
2017
import jakarta.servlet.AsyncContext;
2118
import jakarta.servlet.ServletRequest;
2219
import jakarta.servlet.http.HttpServlet;
2320
import jakarta.servlet.http.HttpServletRequest;
2421
import jakarta.servlet.http.HttpServletResponse;
22+
import java.io.IOException;
23+
import java.io.PrintWriter;
24+
import java.util.concurrent.ThreadPoolExecutor;
2525

2626
/** Test Servlet Async application for AppServer tests. */
2727
public class AsyncServlet extends HttpServlet {
@@ -59,11 +59,14 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
5959

6060
PrintWriter out = resp.getWriter();
6161
out.println("isAsyncStarted : " + servReq.isAsyncStarted());
62-
// This excecutor should be created in the init phase of AppContextListener.
62+
// This executor should be created in the init phase of AppContextListener.
6363
ThreadPoolExecutor executor =
6464
(ThreadPoolExecutor) req.getServletContext().getAttribute("executor");
6565

6666
executor.execute(new LongProcessingRunnable(asyncContext, millisecs));
67+
68+
checkTagSupportClass();
69+
6770
long endTime = System.currentTimeMillis();
6871
System.out.println(
6972
"AsyncServlet End::Thread Name="
@@ -74,4 +77,20 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
7477
+ (endTime - startTime)
7578
+ " ms.");
7679
}
80+
81+
private void checkTagSupportClass() throws RuntimeException {
82+
try {
83+
Class.forName(
84+
"jakarta.servlet.jsp.tagext.TagSupport",
85+
false,
86+
Thread.currentThread().getContextClassLoader());
87+
Class.forName(
88+
"jakarta.el.Expression",
89+
false,
90+
Thread.currentThread().getContextClassLoader());
91+
System.out.println("Successfully loaded jakarta.servlet.jsp.tagext.TagSupport");
92+
} catch (ClassNotFoundException e) {
93+
throw new RuntimeException("Could not load jakarta.servlet.jsp.tagext.TagSupport: " + e);
94+
}
95+
}
7796
}

renovate.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@
77
"com.coveo:fmt-maven-plugin",
88
"com.google.googlejavaformat:google-java-format",
99
"javax.servlet:javax.servlet-api",
10+
"javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api",
1011
"jakarta.servlet:jakarta.servlet-api",
12+
"jakarta.servlet.jsp:*",
13+
"jakarta.servlet.jsp.jstl:*",
14+
"jakarta.el:*",
1115
"org.mortbay.jasper:apache-el",
1216
"org.mortbay.jasper:apache-jsp",
1317
"org.apache.lucene:lucene-core",
14-
"javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api",
1518
"com.google.protobuf:protobuf-java",
1619
"com.google.protobuf:protobuf-java-util",
1720
"com.google.api.grpc:proto-google-common-protos",

runtime_shared_jetty121_ee11/pom.xml

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -30,57 +30,56 @@
3030
<url>https://github.com/GoogleCloudPlatform/appengine-java-standard/</url>
3131
<description>App Engine runtime shared components for Jetty 121 EE11.</description>
3232

33-
<dependencies>
33+
<dependencies>
3434
<dependency>
3535
<groupId>com.google.appengine</groupId>
3636
<artifactId>sessiondata</artifactId>
3737
<optional>true</optional>
3838
</dependency>
39-
<dependency>
39+
<dependency>
4040
<groupId>com.google.appengine</groupId>
4141
<artifactId>runtime-shared</artifactId>
4242
<optional>true</optional>
4343
</dependency>
4444
<dependency>
4545
<groupId>jakarta.servlet</groupId>
4646
<artifactId>jakarta.servlet-api</artifactId>
47-
<version>6.1.0</version>
47+
<version>6.1.0</version> <!--6.1.x is EE11-->
4848
<optional>true</optional>
4949
</dependency>
5050
<dependency>
5151
<groupId>jakarta.servlet.jsp.jstl</groupId>
5252
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
53-
<version>3.0.2</version>
53+
<version>3.0.2</version> <!--3.0.x is EE11-->
5454
<optional>true</optional>
5555
</dependency>
5656
<dependency>
57-
<groupId>org.jspecify</groupId>
57+
<groupId>org.jspecify</groupId>
5858
<artifactId>jspecify</artifactId>
5959
<scope>provided</scope>
6060
</dependency>
6161
<dependency>
62-
<groupId>org.mortbay.jasper</groupId>
63-
<artifactId>apache-jsp</artifactId>
64-
<version>11.0.9</version>
65-
<optional>true</optional>
66-
</dependency>
62+
<!--https://central.sonatype.com/artifact/jakarta.platform/jakartaee-api-parent/11.0.0/overview -->
63+
<groupId>jakarta.el</groupId>
64+
<artifactId>jakarta.el-api</artifactId>
65+
<version>6.0.1</version> <!--6.0.x is EE11-->
66+
</dependency>
6767
<dependency>
68-
<groupId>org.mortbay.jasper</groupId>
69-
<artifactId>apache-el</artifactId>
70-
<version>11.0.9</version>
71-
<optional>true</optional>
68+
<groupId>jakarta.servlet.jsp</groupId>
69+
<artifactId>jakarta.servlet.jsp-api</artifactId>
70+
<version>4.0.0</version> <!--4.0.x is EE11-->
7271
</dependency>
7372
<dependency>
74-
<groupId>com.google.errorprone</groupId>
75-
<artifactId>error_prone_annotations</artifactId>
76-
<optional>true</optional>
77-
</dependency>
73+
<groupId>com.google.errorprone</groupId>
74+
<artifactId>error_prone_annotations</artifactId>
75+
<optional>true</optional>
76+
</dependency>
7877
<dependency>
7978
<groupId>org.eclipse.jetty</groupId>
8079
<artifactId>jetty-xml</artifactId>
8180
<version>${jetty121.version}</version>
8281
</dependency>
83-
</dependencies>
82+
</dependencies>
8483

8584
<build>
8685
<plugins>
@@ -96,39 +95,18 @@
9695
<configuration>
9796
<createSourcesJar>true</createSourcesJar>
9897
<artifactSet>
99-
<excludes>
100-
<exclude>org.eclipse.jdt:ecj</exclude>
101-
</excludes>
10298
<includes>
10399
<include>org.eclipse.jetty.toolchain:jetty-schemas</include>
104100
<include>org.eclipse.jetty:jetty-xml</include>
105-
<include>org.mortbay.jasper:apache-jsp</include>
106-
<include>org.mortbay.jasper:apache-el</include>
107101
<include>com.google.appengine:sessiondata</include>
108102
<include>jakarta.servlet:jakarta.servlet-api</include>
109103
<include>jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api</include>
104+
<include>jakarta.el:jakarta.el-api</include>
105+
<include>jakarta.servlet.jsp:jakarta.servlet.jsp-api</include>
110106
<include>com.google.appengine:runtime-shared</include>
111107
</includes>
112108
</artifactSet>
113109
<filters>
114-
<filter>
115-
<artifact>org.mortbay.jasper:apache-el</artifact>
116-
<includes>
117-
<include>jakarta/el/**</include>
118-
</includes>
119-
<excludes>
120-
<exclude>org/**</exclude>
121-
</excludes>
122-
</filter>
123-
<filter>
124-
<artifact>org.mortbay.jasper:apache-jsp</artifact>
125-
<includes>
126-
<include>jakarta/servlet/jsp/**</include>
127-
</includes>
128-
<excludes>
129-
<exclude>org/**</exclude>
130-
</excludes>
131-
</filter>
132110
<filter>
133111
<artifact>org.eclipse.jetty:jetty-xml</artifact>
134112
<includes>

runtime_shared_jetty12_ee10/pom.xml

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -30,57 +30,56 @@
3030
<url>https://github.com/GoogleCloudPlatform/appengine-java-standard/</url>
3131
<description>App Engine runtime shared components for Jetty 12 and EE10.</description>
3232

33-
<dependencies>
33+
<dependencies>
3434
<dependency>
3535
<groupId>com.google.appengine</groupId>
3636
<artifactId>sessiondata</artifactId>
3737
<optional>true</optional>
3838
</dependency>
39-
<dependency>
39+
<dependency>
4040
<groupId>com.google.appengine</groupId>
4141
<artifactId>runtime-shared</artifactId>
4242
<optional>true</optional>
4343
</dependency>
4444
<dependency>
4545
<groupId>jakarta.servlet</groupId>
4646
<artifactId>jakarta.servlet-api</artifactId>
47-
<version>6.0.0</version>
47+
<version>6.0.0</version> <!--6.0.x is EE10-->
4848
<optional>true</optional>
4949
</dependency>
5050
<dependency>
5151
<groupId>jakarta.servlet.jsp.jstl</groupId>
5252
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
53-
<version>3.0.2</version>
53+
<version>3.0.2</version> <!--3.0.x is EE10-->
5454
<optional>true</optional>
5555
</dependency>
5656
<dependency>
57-
<groupId>org.jspecify</groupId>
57+
<groupId>org.jspecify</groupId>
5858
<artifactId>jspecify</artifactId>
5959
<scope>provided</scope>
6060
</dependency>
6161
<dependency>
62-
<groupId>org.mortbay.jasper</groupId>
63-
<artifactId>apache-jsp</artifactId>
64-
<version>10.1.16</version>
65-
<optional>true</optional>
66-
</dependency>
62+
<!-- https://central.sonatype.com/artifact/jakarta.platform/jakarta.jakartaee-web-api/11.0.0-RC1/jar -->
63+
<groupId>jakarta.el</groupId>
64+
<artifactId>jakarta.el-api</artifactId>
65+
<version>5.0.1</version> <!--5.0.x is EE10-->
66+
</dependency>
6767
<dependency>
68-
<groupId>org.mortbay.jasper</groupId>
69-
<artifactId>apache-el</artifactId>
70-
<version>10.1.16</version>
71-
<optional>true</optional>
68+
<groupId>jakarta.servlet.jsp</groupId>
69+
<artifactId>jakarta.servlet.jsp-api</artifactId>
70+
<version>3.1.1</version> <!--3.1.x is EE10-->
7271
</dependency>
7372
<dependency>
74-
<groupId>com.google.errorprone</groupId>
75-
<artifactId>error_prone_annotations</artifactId>
76-
<optional>true</optional>
77-
</dependency>
73+
<groupId>com.google.errorprone</groupId>
74+
<artifactId>error_prone_annotations</artifactId>
75+
<optional>true</optional>
76+
</dependency>
7877
<dependency>
7978
<groupId>org.eclipse.jetty</groupId>
8079
<artifactId>jetty-xml</artifactId>
8180
<version>${jetty12.version}</version>
8281
</dependency>
83-
</dependencies>
82+
</dependencies>
8483

8584
<build>
8685
<plugins>
@@ -96,39 +95,18 @@
9695
<configuration>
9796
<createSourcesJar>true</createSourcesJar>
9897
<artifactSet>
99-
<excludes>
100-
<exclude>org.eclipse.jdt:ecj</exclude>
101-
</excludes>
10298
<includes>
10399
<include>org.eclipse.jetty.toolchain:jetty-schemas</include>
104100
<include>org.eclipse.jetty:jetty-xml</include>
105-
<include>org.mortbay.jasper:apache-jsp</include>
106-
<include>org.mortbay.jasper:apache-el</include>
107101
<include>com.google.appengine:sessiondata</include>
108102
<include>jakarta.servlet:jakarta.servlet-api</include>
103+
<include>jakarta.el:jakarta.el-api</include>
104+
<include>jakarta.servlet.jsp:jakarta.servlet.jsp-api</include>
109105
<include>jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api</include>
110106
<include>com.google.appengine:runtime-shared</include>
111107
</includes>
112108
</artifactSet>
113109
<filters>
114-
<filter>
115-
<artifact>org.mortbay.jasper:apache-el</artifact>
116-
<includes>
117-
<include>javax/el/**</include>
118-
</includes>
119-
<excludes>
120-
<exclude>org/**</exclude>
121-
</excludes>
122-
</filter>
123-
<filter>
124-
<artifact>org.mortbay.jasper:apache-jsp</artifact>
125-
<includes>
126-
<include>javax/servlet/jsp/**</include>
127-
</includes>
128-
<excludes>
129-
<exclude>org/**</exclude>
130-
</excludes>
131-
</filter>
132110
<filter>
133111
<artifact>org.eclipse.jetty:jetty-xml</artifact>
134112
<includes>

0 commit comments

Comments
 (0)