Re: CDI integration - decision
Hi, It's indeed a tad too late if the Proposed Final Draft is only days away. Perhaps in the meantime individual application servers can do a little bit more to integrate with CDI out of the box, like JBoss already does today. I certainly like to see what we can do for this at Payara. Kind regards, Arjan Tijms
On Wed, Jun 7, 2017 at 11:05 PM, Guillermo González de Agüero <z06.guillermo@...> wrote: Hi Pavel,
|
|
Re: CDI integration - decision
Guillermo González de Agüero
Hi Pavel,
toggle quoted messageShow quoted text
I understand it. We (the community) should have raised this before. I just hope we have this issue as high priority for the next version. Thanks for your efforts! Regards Guillermo González de Agüero
El mié., 7 de junio de 2017 17:17, Pavel Bucek <pavel.bucek@...> escribió:
|
|
Re: Subresource locator - return instance or class
Sounds reasonable. If other vendors agree to support this feature, we should add it to the spec.
From: jaxrs-spec@javaee.groups.io [mailto:jaxrs-spec@javaee.groups.io] On Behalf Of Pavel Bucek
Sent: Mittwoch, 7. Juni 2017 17:29 To: jaxrs-spec@javaee.groups.io Subject: [jaxrs] Subresource locator - return instance or class
Dear experts, we are in a stage when we are re-reading spec document and javadoc (you're welcomed to help us - if you have some favorite typo anywhere in JAX-RS and you wan't to get rid of it, now is the time to report it) and one particular thing was noticed: specification supports only returning an instance as a subresource, thus: @Path("sub1") public SubResource getSubResourceLocator1() { return new SubResource(); } is supported and @Path("sub2") public Class<SubResource> getSubResourceLocator2() { return SubResource.class; } is not. RI currently supports both cases and I'm wondering whether we should add that into the specification. There is obvious advantage of the latter approach, since the instance will be managed (in a correct scope) by the JAX-RS runtime and more importantly, it will be injected, so application developer don't have to inject evertyhing required in a root resource and pass injected values in a constructor of returned instance. What do you think? Thanks and regards,
|
|
Subresource locator - return instance or class
Pavel Bucek
Dear experts, we are in a stage when we are re-reading spec document and javadoc (you're welcomed to help us - if you have some favorite typo anywhere in JAX-RS and you wan't to get rid of it, now is the time to report it) and one particular thing was noticed: specification supports only returning an instance as a subresource, thus:
@Path("sub1") public SubResource getSubResourceLocator1() { return new SubResource(); } is supported and
@Path("sub2") public Class<SubResource> getSubResourceLocator2() { return SubResource.class; } is not. RI currently supports both cases and I'm wondering whether we should add that into the specification. There is obvious advantage of the latter approach, since the instance will be managed (in a correct scope) by the JAX-RS runtime and more importantly, it will be injected, so application developer don't have to inject evertyhing required in a root resource and pass injected values in a constructor of returned instance. What do you think? Thanks and regards,
|
|
Re: CDI integration - decision
Pavel Bucek
Hi Guillermo, I really appreciate your activity around this area, but at this point, I don't think we should consider pursuing any change. We are days from Proposed Final Draft and we still don't have ready everything we HAVE TO deliver. Adding any other (non-trivial) changes like this is like sawing off the branch we’re sitting on.. Thanks and regards,
On 06/06/2017 18:38, Guillermo González
de Agüero wrote:
|
|
Re: module-info or not module-info..
Pavel Bucek
Please see https://github.com/jax-rs/api/commit/f84db6dbb13801411560368deaac7d0d5004db65 Manifest entry "Automatic-Module-Name" was added (based on http://mail.openjdk.java.net/pipermail/jpms-spec-experts/2017-May/000687.html). Module name for JAX-RS API is "java.ws.rs". Corresponding module-info is already part of the API sources, but it is ignored when compiling on Java SE 8, which is what we use. Please let me know if you see any issues. (sooner is better). Regards,
On 04/06/2017 23:11, Pavel Bucek wrote:
I'm waiting for the implementation (since I'd like to test it before the actual commit), but the problem is that I do have some experience with "breaking" changes between jdk 9 builds, so I'm not sure whether the header name is final or not :)
|
|
Re: CDI integration
Santiago Pericas-Geertsen
As others have mentioned, a strength of Java EE is integration with other specs like CDI, JSON-B, etc. But let us not forget that just as important is to ensure backward compatibility; adoption of newer versions of Java EE and JAX-RS depend on this compatibility not being threatened. — Santiago
|
|
Re: CDI integration - decision
Guillermo González de Agüero
Hi, I invited Antoine Sabot Durand (CDI Spec lead) to join the conversation and he replied me today that he and the Weld team will have a look at the issue as they have already been helping other spec integrate with CDI.
On Tue, Jun 6, 2017 at 5:47 PM, Pavel Bucek <pavel.bucek@...> wrote: Dear experts,
|
|
CDI integration - decision
Pavel Bucek
Dear experts,
Thank you for a productive discussion about CDI integration. We now have a good understanding of what can be achieved when using the new CDI 2.0 API. Our recent analysis has concluded that providing a better CDI integration would require more experimentation than what we can do in this minor release. We also don't want to introduce "hard" dependency on CDI API to the JAX-RS API as many JAX-RS developers rely on running JAX-RS outside of CDI context. We agree that CDI can be used as the "glue" of the whole Java EE platform and JAX-RS can do more in terms of the CDI integration when running in a Java EE container. Currently, such enhancements are NOT forbidden at the spec level and JAX-RS providers are free to introduce support that goes beyond what JAX-RS spec mandates. Further experiment in this area can help to gather more feedback for any future re-evaluation of improved CDI/JAX-RS integration story. Also, this feedback may help CDI owners to provide public API enhancements to enable full JAX-RS /CDI integration in a portable way. Thanks again for the discussion on the mailing list. Best regards, Pavel & Santiago
|
|
Re: CDI integration
Turning on CDI by default implies that all methods have to be non-final, which is not backwards compatible to JAX-RS 2.0. So we cannot do that. -Markus
From: jaxrs-spec@javaee.groups.io [mailto:jaxrs-spec@javaee.groups.io] On Behalf Of Ondrej Mihályi
Sent: Dienstag, 6. Juni 2017 16:27 To: jaxrs-spec@javaee.groups.io Subject: Re: [jaxrs] CDI integration
Even it wouldn't be a problem, if @Path annotation isn't a bean defining annotation, the event wouldn't be fired at all in the "annotated" discovery mode if there are no other CDI beans (possible if resources only want to inject beans from other modules).
|
|
Re: CDI integration
I created an new issue to turn the @Path annotation into a CDI stereotype if used in a CDI container: https://github.com/jax-rs/api/issues/556
|
|
Re: CDI integration
Regarding the dependency on CDI, I don't think that JAX-RS must depend on CDI at runtime at this stage. However, it could at least depend on @Inject from JSR 330 which should be preferred to @Context where applicable (naturally everywhere except method parameters).
Ondro
|
|
Re: CDI integration
>> The only caveat is that the implementation will need to know the classes by that point, which is before ServletContainerInitializer is fired that certainly is a problem, we do rely on servlet scanning..Even it wouldn't be a problem, if @Path annotation isn't a bean defining annotation, the event wouldn't be fired at all in the "annotated" discovery mode if there are no other CDI beans (possible if resources only want to inject beans from other modules). The approach of turning @Path into a stereotype is very nice and it doesn't require a runtime dependency on CDI at all. CDI API would be needed only to compile JAX-RS API because annotations not found on the classpath are ignored by the JVM, CDI impl wouldn't be needed at all. If we specify @RequestScoped in the stereotype, it would just specify what I believe all implementations do anyway -> create a resource instance per request, which is the default behavior mandated by the previous JAX-RS 2.0 It would be possible to override the scope for each class in a standard way by providing a scope annotation along with @Path. Furthermore, if @Path is a stereotype, it would also become a bean-defining annotation and turn on CDI by default, even if there are no other CDI beans in the module, which is what most people would expect. Ondro
|
|
Re: Status update
Hi Pavel,
2017-06-05 11:07 GMT+02:00 Pavel Bucek <pavel.bucek@oracle.com>: Hi Gunnar,The fallback mechanism of the JDK ResourceBundle API will kick in which depends on the relationship between requested locales. So say L3 = EN_US and L2 = EN, the ResourceBundle API automatically will take care of that fallback and use EN if no messages for EN_US are present. If L2 was something unrelated, e.g. FR then it'd fall back to the default messages in whatever language defined by the user (and in English as measure of last resort for the built-in constraints). I thought that's where the suggested LocaleResolver SPI comes in. The user will know in which languages they have provided validation messages, so they could plug in an alternative LocaleResolver which could select L2 over L3 in your example. Isn't that what the LocalResolver SPI exactly is about?
|
|
Re: Status update
Hi Pavel,
thank you for adding this. I filed the OCA yesterday so next time you should be able to accept my contributions. Regards Dennis
|
|
Re: Status update
Pavel Bucek
oops. :) will be fixed in the next milestone. Thanks,
On 06/06/2017 06:27, Christian
Kaltepoth wrote:
|
|
Re: Status update
Hey Pavel, thanks a lot. It is great to finally see this feature in the spec. Just one minor typo: "withing" should be "within". See: Christian 2017-06-05 21:13 GMT+02:00 Pavel Bucek <pavel.bucek@...>:
--
|
|
Re: Status update
Pavel Bucek
toggle quoted messageShow quoted text
On 04/06/2017 23:15, Pavel Bucek wrote:
|
|
Re: Status update
Pavel Bucek
Hi Gunnar,
toggle quoted messageShow quoted text
I'm sorry to say that, but I don't think that proposal is viable. What if the app (BV layer) knows Locales L1 and L2 and the user (request) asks for L3;q=0.9, L2;q=0.5, L1;q=0.1. In the latest version of the proposal, L3 will be chosen - what happens when L3 is passed to BV? Producing an error? Using a default Locale? Neither is a good behavior, L2 should be selected. I haven't seen anything in BV which would return set of supported locales.. Also, the selected locale (whatever it is), should be made available to JAX-RS application, so it can work with that further if needed. We don't have anything like that now. Not to mention that the selection process might need to be pluggable. Last but not least - we would need to define how is the selected Locale used in whole context of JAX-RS application, which might sound easier as it is. Best regards, Pavel
On 05/06/2017 10:06, Gunnar Morling via Groups.Io wrote:
Hi Pavel,
|
|
Re: Status update
Hi Pavel,
toggle quoted messageShow quoted text
Any chance for considering the latest proposal for passing the (highest-quality) request locale to Bean Validation? Thanks, --Gunnar 2017-06-02 14:48 GMT+02:00 Pavel Bucek <pavel.bucek@oracle.com>:
Dear experts,
|
|