-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#233] Reactivating the Thymeleaf extension #291
Conversation
c101eee
to
db42dd2
Compare
Maybe we could simply "produce" an application-scoped instance of
It is just a guess, but if we use
To make things more complicated: HttpServletRequests can be wrapped via servlet filter. We actually even have some special handling in Krazo to "unwrap" these wrappers. The result is what you will get from krazo/core/src/main/java/org/eclipse/krazo/core/ViewableWriter.java Lines 136 to 137 in d2467da
Maybe I'll find some time tomorrow to have a look at your branch. |
Thanks, that seems to be the case. My current (local) codebase uses option D and that works. |
I now have it in a working state and pushed the changes. Have a look and tell me what you think. |
...eleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/JakartaServletWebApplicationWrapper.java
Outdated
Show resolved
Hide resolved
I don't like my current solution at all.
|
@chkal after a look into the PR I'm afraid we need a CQ because of the minor update, right? Do you know if we need one for the final 3.1.0 again after creating one for 3.1.0.M1? |
Good idea, thanks for doing that 🍻 |
As we agreed yesterday in the MVC Spec Meeting: Since there is no reaction from Thymeleaf maintainers to my PR, we'll just merge this current solution. The only open point is the CQ that @erdlet pointed out.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jelemux. Sorry for the super long delay. I finally found some time to review your changes.
Overall, it looks great. I just added a few comments, but I would also be fine with merging the current state of the PR. Feel free to have a look at my comments. :-)
ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/CDIWebContext.java
Outdated
Show resolved
Hide resolved
private HttpServletRequest request; | ||
|
||
@Produces | ||
@ApplicationScoped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add the @Internal
qualifier here? We use this qualifier for some beans used internally by Krazo to protect ourselves against potential conflicts with other libraries which produce the same type as well. We use it for HttpServletRequest
for example.
I'm not super sure if we should do it here as well. I just wanted to mention it. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to understand what the @Internal
qualifier does but I don't know if I fully get it yet.
If using it means that the user cannot provide their own producer to override ours, then I would refrain from using it because it might be useful for the user to configure JakartaServletWebApplication
themselves.
Also if you were afraid that the user might want to inject a JakartaServletWebApplicationWrapper
somewhere in their code using their own producer: I don't think that this should happen as JakartaServletWebApplicationWrapper
was written by us specifically for the purpose we are using it for and nothing else.
I hope that clarified things and that I correctly understood what @Internal
does.
…es in Thymeleaf This reenables the Thymeleaf extension by using its 3.1.0.M1 milestone release (which uses the jakarta namespace). To adapt to changes in Thymeleaf, CDIWebContext had to be changed to use the jakarta namespace and the new IWebExchange. Since `JakartaServletWebApplication` has been established to wrap ServletContext in Thymeleaf, there needed to be a producer to inject it into both `DefaultTemplateEngineProducer` and `ThymeleafViewEngine`. But because `JakartaServletWebApplication` is a final class, a wrapper for it had to be written in order to use CDI.
a7d4a35
to
afd97de
Compare
CQ is approved, so we can finally merge this PR :) @jelemux please let me known if you want to squash something before merge or if everything is fine for you. |
I already squashed everything, so should be good to go for the merge |
This reenables the Thymeleaf extension by using its 3.1.0.M1 milestone release (which uses the jakarta namespace).
To adapt to changes in Thymeleaf, CDIWebContext had to be changed to use the jakarta namespace and the new IWebExchange. Since
JakartaServletWebApplication
has been established to wrap ServletContext in Thymeleaf, there needed to be a producer to inject it into bothDefaultTemplateEngineProducer
andThymeleafViewEngine
. But becauseJakartaServletWebApplication
is a final class, a wrapper for it had to be written in order to use CDI.Fixes #233