You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2017/04/27 21:15:04 UTC

[jira] [Commented] (CXF-7333) Custom resource comparator not called on sub-resource classes

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

Sergey Beryozkin commented on CXF-7333:
---------------------------------------

I can not reproduce it, I experimented with one of the existing tests and the custom comparator is called both when the multiple candidates are available both on the root and sub resources.

Can you please create a Maven based test project ?

> Custom resource comparator not called on sub-resource classes
> -------------------------------------------------------------
>
>                 Key: CXF-7333
>                 URL: https://issues.apache.org/jira/browse/CXF-7333
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.11
>         Environment: Mac OS X 10.12.4
> Oracle Java Runtime 1.8.0_60-b27
> Tomcat 8.5.11
> debugged and executed via Eclipse Neon.3 Release (4.6.3) 
>            Reporter: Thomas Iguchi
>
> I created a custom `ResourceComparator` according to the documentation: https://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Customselectionbetweenmultipleresourcesoroperations
> Its method for comparing resource classes gets called just fine, but the one for comparing two instances of OperationResourceInfo never gets called when I want to invoke a method of a sub-resource class such as the following example for illustration:
> ```
> @Path("subpath")
> public class SubResource {
>     @POST
>     public Response createSomething() {
>         // ... this is the method I want to compare, since there's a "competitor" with the same method signature in  an abstract base class
>     }
> }
> @Path("/rootpath")
> public class RootResource {
>     @Path("subpath")
>     public SubResource subResource() {
>          return new SubResource();
>     }
> }
> ```
> I stepped through the CXF code and could narrow down the problem to the following line of code:
> In line 48 of `org.apache.cxf.jaxrs.model.OperationResourceInfoComparator` the looked up custom comparator from the environment returns as `null`. It appears as if the message endpoint object for the sub-resource class contains incomplete information about the environment.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)