[ 
https://issues.apache.org/jira/browse/CXF-7614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16332250#comment-16332250
 ] 

Sergey Beryozkin commented on CXF-7614:
---------------------------------------

OK, this last issue has been fixed, I've redeployed, so you can test right now.
As far as DynamicFeature is concerned then, enabling the static resolution will 
ensure it is applied to the subresources. This will work well for the vast 
majority of the cases.

The minor concern is what to do in a (nearly theoretical) case, which the spec 
refers to, when we have SubResource class typed as a return value of the 
locator, while at the runtime, a SubResourceExt extension is returned, which 
overrides some of JAX-RS annotations of SubResource thus possibly affecting the 
method dispatch, etc.
In this case the static resolution needs to be disabled -> the feature won't be 
applied to subresources. 

Sure, for the purpose of applying the dynamic feature, we might in principle 
ignore that property, but that would lead exactly to the same problem, the 
feature implementation will see the static types like SubResource, not 
SubResourceExt.

The twist here is that with Object subresources it is not applied anyway. 

Thus the question, is the feature expected to be applied dynamically during the 
request time ? That would be a big problem - as it would affect sorting the 
providers during the request time, and would be very expensive...

I'd just go with enabling the static resolution and be done with it...



> DynamicFeature is not invoked for sub resources
> -----------------------------------------------
>
>                 Key: CXF-7614
>                 URL: https://issues.apache.org/jira/browse/CXF-7614
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.2.2
>            Reporter: Carlos Sierra
>            Priority: Major
>
> According to the javadoc of DynamicFeature the callback method is to be 
> invoked for relevant methods in resource or sub-resources. In the current 
> implementation methods on sub-resource are NOT being invoked.
> {code:java}
> public class ResourceWithSubResource {
>     @Path("/resource1")
>     public SubResource getResource() {
>         return new SubResource("Resource1: ");
>     }
> }{code}
> {code:java}
> public class SubResource {
>     public SubResource(String param) {
>         _param = param;
>     }
>     @GET
>     public String getParam() {
>         return "Returning: " + _param;
>     }
>     @Path("/{path}")
>     public SubResource subPath(@PathParam("path") String subPath) {
>         return new SubResource(_param + "-" + subPath);
>     }
>     private String _param;
> }
> {code}
> in the provided example a _DynamicFeature_ is only invoked for 
> _getResource()_ and it should also be invoked for relevant methods in 
> _SubResource_.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to