Skip to content

Commit 69dfcdb

Browse files
ludochgae-java-bot
authored andcommitted
Add Jakarta EE versions of test webapp modules to the runtime build.
PiperOrigin-RevId: 799190382 Change-Id: I9ad3d39f3d22f7a1e5fec57eb2564295b980dfcf
1 parent fae09c5 commit 69dfcdb

18 files changed

Lines changed: 643 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2021 Google LLC
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
https://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<project xmlns="http://maven.apache.org/POM/4.0.0"
18+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20+
21+
<modelVersion>4.0.0</modelVersion>
22+
<packaging>war</packaging>
23+
<parent>
24+
<groupId>com.google.appengine</groupId>
25+
<artifactId>runtime-parent</artifactId>
26+
<version>2.0.39-SNAPSHOT</version>
27+
</parent>
28+
<groupId>com.google.appengine.demos</groupId>
29+
<artifactId>annotationscanningwebappjakarta</artifactId>
30+
<name>AppEngine :: annotationscanningwebapp jakarta</name>
31+
32+
<properties>
33+
<maven.deploy.skip>true</maven.deploy.skip>
34+
<appengine.app.version>1</appengine.app.version>
35+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36+
</properties>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>jakarta.servlet</groupId>
41+
<artifactId>jakarta.servlet-api</artifactId>
42+
<version>6.0.0</version>
43+
<scope>provided</scope>
44+
</dependency>
45+
</dependencies>
46+
<build>
47+
<outputDirectory>target/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory>
48+
<plugins>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-war-plugin</artifactId>
52+
<version>3.4.0</version>
53+
<configuration>
54+
<archiveClasses>true</archiveClasses>
55+
<webResources>
56+
<!-- in order to interpolate version from pom into appengine-web.xml -->
57+
<resource>
58+
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
59+
<filtering>true</filtering>
60+
<targetPath>WEB-INF</targetPath>
61+
</resource>
62+
</webResources>
63+
</configuration>
64+
</plugin>
65+
<plugin>
66+
<artifactId>maven-compiler-plugin</artifactId>
67+
<version>3.14.0</version>
68+
<configuration>
69+
<release>8</release>
70+
</configuration>
71+
</plugin>
72+
</plugins>
73+
</build>
74+
75+
</project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import java.io.IOException;
18+
import java.io.PrintWriter;
19+
import jakarta.servlet.ServletException;
20+
import jakarta.servlet.annotation.WebServlet;
21+
import jakarta.servlet.http.HttpServlet;
22+
import jakarta.servlet.http.HttpServletRequest;
23+
import jakarta.servlet.http.HttpServletResponse;
24+
25+
/** Servlet that detects if the GAE APIs are in the app classpath. */
26+
@WebServlet(
27+
name = "AnnotationScanningServlet",
28+
urlPatterns = {"/"})
29+
public class AnnotationScanningServlet extends HttpServlet {
30+
31+
@Override
32+
protected void service(HttpServletRequest req, HttpServletResponse resp)
33+
throws ServletException, IOException {
34+
resp.setContentType("text/plain");
35+
PrintWriter out = resp.getWriter();
36+
// Testing that appengine-api-1.0-sdk.jar is not on the application classpath
37+
// if the app does not define it.
38+
try {
39+
Class.forName("com.google.appengine.api.utils.SystemProperty");
40+
throw new IllegalArgumentException("com.google.appengine.api.utils.SystemProperty");
41+
42+
} catch (ClassNotFoundException expected) {
43+
out.println("ok, com.google.appengine.api.utils.SystemProperty not seen.");
44+
}
45+
}
46+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
runtime: java21
16+
inbound_services:
17+
- warmup
18+
derived_file_type:
19+
- java_precompiled
20+
threadsafe: True
21+
auto_id_policy: default
22+
api_version: 'user_defined'
23+
handlers:
24+
- url: /.*
25+
script: unused
26+
login: optional
27+
secure: optional
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2021 Google LLC
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
https://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
18+
<runtime>java21</runtime>
19+
</appengine-web-app>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
use.annotationscanning=true
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2021 Google LLC
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
https://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<web-app
18+
xmlns="http://java.sun.com/xml/ns/javaee"
19+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
21+
version="3.1">
22+
</web-app>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2021 Google LLC
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
https://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<project xmlns="http://maven.apache.org/POM/4.0.0"
18+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20+
21+
<modelVersion>4.0.0</modelVersion>
22+
<packaging>war</packaging>
23+
<parent>
24+
<groupId>com.google.appengine</groupId>
25+
<artifactId>runtime-parent</artifactId>
26+
<version>2.0.39-SNAPSHOT</version>
27+
</parent>
28+
<groupId>com.google.appengine.demos</groupId>
29+
<artifactId>failinitfilterwebappjakarta</artifactId>
30+
<name>AppEngine :: failinitfilterwebapp jakarta</name>
31+
32+
<properties>
33+
<maven.deploy.skip>true</maven.deploy.skip>
34+
<appengine.app.version>1</appengine.app.version>
35+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36+
</properties>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>jakarta.servlet</groupId>
41+
<artifactId>jakarta.servlet-api</artifactId>
42+
<version>6.0.0</version>
43+
<scope>provided</scope>
44+
</dependency>
45+
</dependencies>
46+
<build>
47+
<outputDirectory>target/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory>
48+
<plugins>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-war-plugin</artifactId>
52+
<version>3.4.0</version>
53+
<configuration>
54+
<archiveClasses>true</archiveClasses>
55+
<webResources>
56+
<!-- in order to interpolate version from pom into appengine-web.xml -->
57+
<resource>
58+
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
59+
<filtering>true</filtering>
60+
<targetPath>WEB-INF</targetPath>
61+
</resource>
62+
</webResources>
63+
</configuration>
64+
</plugin>
65+
<plugin>
66+
<artifactId>maven-compiler-plugin</artifactId>
67+
<version>3.14.0</version>
68+
<configuration>
69+
<release>8</release>
70+
</configuration>
71+
</plugin>
72+
<plugin>
73+
<groupId>com.google.cloud.tools</groupId>
74+
<artifactId>appengine-maven-plugin</artifactId>
75+
<version>2.8.3</version>
76+
<configuration>
77+
<projectId>ludo-in-in</projectId>
78+
<version>failinitfilter</version>
79+
<promote>false</promote>
80+
<automaticRestart>true</automaticRestart>
81+
</configuration>
82+
</plugin>
83+
</plugins>
84+
</build>
85+
86+
</project>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import jakarta.servlet.Filter;
18+
import jakarta.servlet.FilterChain;
19+
import jakarta.servlet.FilterConfig;
20+
import jakarta.servlet.ServletException;
21+
import jakarta.servlet.ServletRequest;
22+
import jakarta.servlet.ServletResponse;
23+
24+
public class FailInitializationFilter implements Filter {
25+
@Override
26+
public void init(FilterConfig config) throws ServletException {
27+
throw new ServletException("Intentionally failing to initialize.");
28+
}
29+
30+
@Override
31+
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
32+
throws ServletException {
33+
throw new ServletException("Unexpectedly got a request.");
34+
}
35+
36+
@Override
37+
public void destroy() {}
38+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
runtime: java21
16+
inbound_services:
17+
- warmup
18+
threadsafe: True
19+
auto_id_policy: default
20+
api_version: 'user_defined'
21+
handlers:
22+
- url: /.*
23+
script: unused
24+
login: optional
25+
secure: optional
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2021 Google LLC
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
https://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
18+
<runtime>java21</runtime>
19+
</appengine-web-app>

0 commit comments

Comments
 (0)