You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Thomas Iguchi (JIRA)" <ji...@apache.org> on 2017/04/11 18:14:41 UTC

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

Thomas Iguchi created CXF-7333:
----------------------------------

             Summary: 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)