You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Neal Hu (JIRA)" <ji...@apache.org> on 2016/05/24 16:13:12 UTC

[jira] [Commented] (CXF-6917) SuperClass and Interface's Annotations are ignored when the Method contains ParameterAnnotation

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

Neal Hu commented on CXF-6917:
------------------------------

I made a tentative test removing  below at AnnotationUtils:167, then both /hello3 and /hello?name=neal returned as expected. Will attach patch tomorrow.

            for (Annotation[] paramAnnotations : m.getParameterAnnotations()) {
                if (isValidParamAnnotations(paramAnnotations)) {
                    LOG.warning("Method " + m.getName() + " in " + m.getDeclaringClass().getName()
                                 + " has no JAX-RS Path or HTTP Method annotations");
                    return m;
                }
            }
Neal

> SuperClass and Interface's Annotations are ignored when the Method contains ParameterAnnotation
> -----------------------------------------------------------------------------------------------
>
>                 Key: CXF-6917
>                 URL: https://issues.apache.org/jira/browse/CXF-6917
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.6
>         Environment: Mac java 8
>            Reporter: Neal Hu
>             Fix For: 3.0.10, 3.2.0, 3.1.8
>
>
> Suppose we have below interface and its implementation:
> public interface HelloWorld {
>     @GET
>     @Path("/hello")
>     String sayHello(@QueryParam("name") String name);
>     @GET
>     @Path("/hello3")
>     String sayHello3();
> }
> @Path("/")
> public class HelloWorldImpl implements HelloWorld {
> 	@Override
> 	public String sayHello(@QueryParam("name") String name){
> 		return "hello " + name;
> 	}
> 	@GET
> 	@Path("/hello2")
> 	public String sayHello2(@QueryParam("name") String name){
> 		return "hello2 " + name;
> 	}
> 	@Override
> 	public String sayHello3(){
> 		return "hello3 ";
> 	}
> }
> Get /hello3 works good. but Get /hello?name=neal will result in 404. The expected output is hello neal.
> The root cause is in org.apache.cxf.jaxrs.utils.AnnotationUtils:167 CXF ignores the recurrence search of the method who has parameter annotations.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)