Skip to content

Fix bug where policy context was not cleared before policy retranslate - #25728

Merged
arjantijms merged 2 commits into
eclipse-ee4j:8.0from
arjantijms:8_0_fix_retranslate_policy_bug
Oct 17, 2025
Merged

Fix bug where policy context was not cleared before policy retranslate#25728
arjantijms merged 2 commits into
eclipse-ee4j:8.0from
arjantijms:8_0_fix_retranslate_policy_bug

Conversation

@arjantijms

Copy link
Copy Markdown
Contributor

When a servlet or filter is added dynamically, internally GlassFish triggers a Policy retranslate. This means indexing of URLs for permissions etc is done again.

Jersey happens to do such dynamic add, and thus triggers this retranslation.

We had a bug there, where the previous context was not properly cleared. This particularly meant that the "http request capturing lambda" was still the one from the first translation. After the retranslation, the lambda of the second context was given the http request, but the first one was still being used when application code asked for it. The first one was never given the request, so would always return null.

The request is used currently for the SecurityContext implementation of Soteria (although we are bound to change this in a later version). The included test therefor also looks at this stored request directly.

@arjantijms arjantijms added this to the 8.0.0 milestone Oct 8, 2025
@arjantijms arjantijms self-assigned this Oct 8, 2025
<!--
The Arquillian connector that starts GlassFish and deploys archives to it.
-->
<dependency>

@dmatej dmatej Oct 8, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates cyclic dependency. It depends on GlassFish project, now Glassfish project depends on the container too. It seems to me that there is yet bit more redundant things.
Can I merge it to application-tests instead? We also don't need to have new pom (or two) for every test.

EDIT: Ok, we already have the dependency in TCK submodules ... I forgot about this aspect, however as the plugin can support multiple GF versions, it is probably ok.
However I would still move it to application-tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we already have the dependency in TCK submodules

yeah, it's modelled exactly after the TCK submodule. We don't have application-tests btw, but I think it's appserv-tests you mean then?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

</description>

<dependencies>
<dependency>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to explicitly declare which specs we need here ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took this particular app from another demo app I was working on, where just the EE dependency was more convenient. For here I can specify the exact APIs used indeed.

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need the beans.xml here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, we indeed don't need it. Left-over from the app I took it from.

@arjantijms
arjantijms merged commit 365a888 into eclipse-ee4j:8.0 Oct 17, 2025
1 of 2 checks passed
@arjantijms
arjantijms deleted the 8_0_fix_retranslate_policy_bug branch October 21, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants