Skip to content

Fix devappserver support for JaxRS applications without a web.xml#470

Merged
copybara-service[bot] merged 7 commits intomainfrom
jaxrs
Feb 5, 2026
Merged

Fix devappserver support for JaxRS applications without a web.xml#470
copybara-service[bot] merged 7 commits intomainfrom
jaxrs

Conversation

@ludoch
Copy link
Collaborator

@ludoch ludoch commented Feb 5, 2026

No description provided.

ludoch and others added 4 commits January 23, 2026 16:10
* Hardcode several JavaRuntimeParams values.

PiperOrigin-RevId: 860637485
Change-Id: Ibbd87902f4ef73e3620180ad870dc8200a40b417

* Modernize Java syntax to JDK17 level in App Engine code base.

PiperOrigin-RevId: 861206703
Change-Id: If6a63e7bae3d33e833cf752ee8313d88b9dffa86

* Update all non-major dependencies

* Refactor: Use lambda expressions and Character.valueOf.

PiperOrigin-RevId: 862378286
Change-Id: I140e95ffda132265f442bc1d222c587331e367d6

* Update all non-major dependencies

* Refactor AppEngineWebXmlInitialParse to allow mocking environment variables and add a test.
New Test Permutations
We added new test cases to AppEngineWebXmlInitialParseTest.java to ensure full coverage of Runtime, Jetty, and Jakarta EE version combinations:

testJava17WithExperimentEnableJetty12: Verifies that when the environment variable EXPERIMENT_ENABLE_JETTY12_FOR_JAVA is set to true for the java17 runtime (simulated via envProvider), the configuration correctly defaults to appengine.use.EE8=true (Jetty 12.0 in EE8 mode) instead of the standard Jetty 9.4 legacy mode.

testHttpConnectorExperiment: Verifies that when EXPERIMENT_ENABLE_HTTP_CONNECTOR_FOR_JAVA is set to true, the system properties appengine.use.HttpConnector and appengine.ignore.cancelerror are automatically enabled.

testJava17WithJetty121: Verifies that for the java17 runtime, enabling appengine.use.jetty121 alone does not inadvertently enable Jakarta EE 8, 10, or 11.

It confirms that the configuration remains valid with only the Jetty 12.1 flag set.

testJava17WithEE8AndJetty121: Verifies that for java17, explicitly enabling both appengine.use.EE8 and appengine.use.jetty121 correctly sets both properties to true, supporting the legacy EE8 environment on the newer Jetty infrastructure.

testJava21WithEE10Explicit: Confirms that explicitly setting appengine.use.EE10 for java21 (which is the default) works as expected, ensuring EE10 is true and jetty121 remains false (mapping to Jetty 12.0).

testJava21WithEE8AndJetty121: Verifies that for java21, combining appengine.use.EE8 with appengine.use.jetty121 correctly enables both flags.
Environment Variable Emulation
To reliably test logic dependent on environment variables (such as EXPERIMENT_ENABLE_JETTY12_FOR_JAVA or EXPERIMENT_ENABLE_HTTP_CONNECTOR_FOR_JAVA) without modifying the actual system environment or affecting other tests:

The AppEngineWebXmlInitialParse class now accepts a custom envProvider (a UnaryOperator<String>) via the package-private setEnvProvider method.
By default, this provider delegates to System::getenv.

In tests, we inject a lambda function (e.g., key -> "true") to simulate specific environment variables being set.

This allows us to verify that the parser correctly activates experimental features or defaults based on the environment.

testSystemPropertyOverrideRuntime: This test sets the GAE_RUNTIME system property to "java21" (while the XML specifies "java17") and verifies that the runtime logic correctly switches to "java21" behavior (defaulting to EE10). This kills the mutant where runtimeId re-fetching from system properties (line 178) was removed, as the test would fail if runtimeId remained "java17".

testSystemPropertyOverrideRuntimeWithWhitespace: This test sets GAE_RUNTIME to " java21 " (with whitespace) and asserts that the code correctly handles it as "java21" (setting EE10 to true). This kills the mutant where the trim() call (lines 179-181) was removed, as the test would fail if the whitespace prevented the "java21" logic from triggering.

testLogEE8: This test captures the logs generated by AppEngineWebXmlInitialParse and asserts that "appengine.use.EE8=true" is logged when EE8 is enabled. This kills the mutant where the logging logic for EE8 (lines 249-251) was removed.
PiperOrigin-RevId: 862787419
Change-Id: I1bc08a2ee06faa1018f0f225e8ca90f358cc094d

* Update all non-major dependencies

* Refactor StringBuilder usage to use append() calls.

PiperOrigin-RevId: 863263787
Change-Id: I5b7805c536e69fd544fc71edadd0d799e3e5c145

* Update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.15.0

* Update Jetty versions and servlet API jar.

Update Jetty 12.0.x to 12.0.32 and Jetty 12.1.x to 12.1.6. Also, update the Jetty servlet API jar from 4.0.6 to 4.0.9 in the Jetty121EE8Sdk configuration.

PiperOrigin-RevId: 864150501
Change-Id: Idc20a1e9abda7b10f9a0e695ad979d3e6cbaa7a2

* temporary fix to AppEngineAnnotationConfiguration for issue #462

Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>

---------

Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: GAE Java Team <gae-java-bot@google.com>
Co-authored-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@google-cla
Copy link

google-cla bot commented Feb 5, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

* Hardcode several JavaRuntimeParams values.

PiperOrigin-RevId: 860637485
Change-Id: Ibbd87902f4ef73e3620180ad870dc8200a40b417

* Modernize Java syntax to JDK17 level in App Engine code base.

PiperOrigin-RevId: 861206703
Change-Id: If6a63e7bae3d33e833cf752ee8313d88b9dffa86

* Update all non-major dependencies

* Refactor: Use lambda expressions and Character.valueOf.

PiperOrigin-RevId: 862378286
Change-Id: I140e95ffda132265f442bc1d222c587331e367d6

* Update all non-major dependencies

* Refactor AppEngineWebXmlInitialParse to allow mocking environment variables and add a test.
New Test Permutations
We added new test cases to AppEngineWebXmlInitialParseTest.java to ensure full coverage of Runtime, Jetty, and Jakarta EE version combinations:

testJava17WithExperimentEnableJetty12: Verifies that when the environment variable EXPERIMENT_ENABLE_JETTY12_FOR_JAVA is set to true for the java17 runtime (simulated via envProvider), the configuration correctly defaults to appengine.use.EE8=true (Jetty 12.0 in EE8 mode) instead of the standard Jetty 9.4 legacy mode.

testHttpConnectorExperiment: Verifies that when EXPERIMENT_ENABLE_HTTP_CONNECTOR_FOR_JAVA is set to true, the system properties appengine.use.HttpConnector and appengine.ignore.cancelerror are automatically enabled.

testJava17WithJetty121: Verifies that for the java17 runtime, enabling appengine.use.jetty121 alone does not inadvertently enable Jakarta EE 8, 10, or 11.

It confirms that the configuration remains valid with only the Jetty 12.1 flag set.

testJava17WithEE8AndJetty121: Verifies that for java17, explicitly enabling both appengine.use.EE8 and appengine.use.jetty121 correctly sets both properties to true, supporting the legacy EE8 environment on the newer Jetty infrastructure.

testJava21WithEE10Explicit: Confirms that explicitly setting appengine.use.EE10 for java21 (which is the default) works as expected, ensuring EE10 is true and jetty121 remains false (mapping to Jetty 12.0).

testJava21WithEE8AndJetty121: Verifies that for java21, combining appengine.use.EE8 with appengine.use.jetty121 correctly enables both flags.
Environment Variable Emulation
To reliably test logic dependent on environment variables (such as EXPERIMENT_ENABLE_JETTY12_FOR_JAVA or EXPERIMENT_ENABLE_HTTP_CONNECTOR_FOR_JAVA) without modifying the actual system environment or affecting other tests:

The AppEngineWebXmlInitialParse class now accepts a custom envProvider (a UnaryOperator<String>) via the package-private setEnvProvider method.
By default, this provider delegates to System::getenv.

In tests, we inject a lambda function (e.g., key -> "true") to simulate specific environment variables being set.

This allows us to verify that the parser correctly activates experimental features or defaults based on the environment.

testSystemPropertyOverrideRuntime: This test sets the GAE_RUNTIME system property to "java21" (while the XML specifies "java17") and verifies that the runtime logic correctly switches to "java21" behavior (defaulting to EE10). This kills the mutant where runtimeId re-fetching from system properties (line 178) was removed, as the test would fail if runtimeId remained "java17".

testSystemPropertyOverrideRuntimeWithWhitespace: This test sets GAE_RUNTIME to " java21 " (with whitespace) and asserts that the code correctly handles it as "java21" (setting EE10 to true). This kills the mutant where the trim() call (lines 179-181) was removed, as the test would fail if the whitespace prevented the "java21" logic from triggering.

testLogEE8: This test captures the logs generated by AppEngineWebXmlInitialParse and asserts that "appengine.use.EE8=true" is logged when EE8 is enabled. This kills the mutant where the logging logic for EE8 (lines 249-251) was removed.
PiperOrigin-RevId: 862787419
Change-Id: I1bc08a2ee06faa1018f0f225e8ca90f358cc094d

* Update all non-major dependencies

* Refactor StringBuilder usage to use append() calls.

PiperOrigin-RevId: 863263787
Change-Id: I5b7805c536e69fd544fc71edadd0d799e3e5c145

* Update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.15.0

* Update Jetty versions and servlet API jar.

Update Jetty 12.0.x to 12.0.32 and Jetty 12.1.x to 12.1.6. Also, update the Jetty servlet API jar from 4.0.6 to 4.0.9 in the Jetty121EE8Sdk configuration.

PiperOrigin-RevId: 864150501
Change-Id: Idc20a1e9abda7b10f9a0e695ad979d3e6cbaa7a2

* Re-enable and migrate RemoteDatastoreTest to Proto2 API and move remaining internal tests to open source.

PiperOrigin-RevId: 865415153
Change-Id: I26706754398304cfe4567583ffb84e0d9f2d73f1

* Move AppInfoFactory to a common package as it is not Jetty specific and can be shared across all Jetty versions.

PiperOrigin-RevId: 865965002
Change-Id: I04d68e5e83ee9219c20b4fac974070a400bbb662

---------

Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: GAE Java Team <gae-java-bot@google.com>
Removed the call to setDumpAfterStart on the server.
Uncommented test cases for Java versions in JaxRsTest.
@copybara-service copybara-service bot merged commit 0bcbd79 into main Feb 5, 2026
11 checks passed
@copybara-service copybara-service bot deleted the jaxrs branch February 5, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant