[jira] [Updated] (CXF-7921) JAXRS CDI extension ignores interfaces annotations

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (CXF-7921) JAXRS CDI extension ignores interfaces annotations

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/CXF-7921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Romain Manni-Bucau updated CXF-7921:
------------------------------------
    Description:
https://github.com/apache/cxf/blob/master/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java#L194 should also consider interfaces of the annotated type cause they can host @Path in a contract driven approach

Here is a version for collect method:

{code}
if (!event.getAnnotated().isAnnotationPresent(Path.class) && AnnotatedType.class.isInstance(event.getAnnotated())) {
                final AnnotatedType<?> type = AnnotatedType.class.cast(event.getAnnotated());
                // note: should we use Annotated for interfaces as well?
                if (type.getTypeClosure().stream()
                        .filter(it -> Class.class.isInstance(it) && Class.class.cast(it).isInterface())
                        .map(Class.class::cast)
                        .anyMatch(c -> c.isAnnotationPresent(Path.class))) {
                    try {
                        List.class.cast(serviceBeans.get(this)).add(event.getBean());
                        return;
                    } catch (final IllegalAccessException e) {
                        new org.apache.meecrowave.logging.tomcat.LogFacade(Cxfs.class.getName())
                                .error(e.getMessage(), e);
                    }
                }
            }
// else current code
{code}

  was:https://github.com/apache/cxf/blob/master/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java#L194 should also consider interfaces of the annotated type cause they can host @Path in a contract driven approach


> JAXRS CDI extension ignores interfaces annotations
> --------------------------------------------------
>
>                 Key: CXF-7921
>                 URL: https://issues.apache.org/jira/browse/CXF-7921
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.2.7
>            Reporter: Romain Manni-Bucau
>            Priority: Major
>
> https://github.com/apache/cxf/blob/master/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java#L194 should also consider interfaces of the annotated type cause they can host @Path in a contract driven approach
> Here is a version for collect method:
> {code}
> if (!event.getAnnotated().isAnnotationPresent(Path.class) && AnnotatedType.class.isInstance(event.getAnnotated())) {
>                 final AnnotatedType<?> type = AnnotatedType.class.cast(event.getAnnotated());
>                 // note: should we use Annotated for interfaces as well?
>                 if (type.getTypeClosure().stream()
>                         .filter(it -> Class.class.isInstance(it) && Class.class.cast(it).isInterface())
>                         .map(Class.class::cast)
>                         .anyMatch(c -> c.isAnnotationPresent(Path.class))) {
>                     try {
>                         List.class.cast(serviceBeans.get(this)).add(event.getBean());
>                         return;
>                     } catch (final IllegalAccessException e) {
>                         new org.apache.meecrowave.logging.tomcat.LogFacade(Cxfs.class.getName())
>                                 .error(e.getMessage(), e);
>                     }
>                 }
>             }
> // else current code
> {code}



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