CXF
  1. CXF
  2. CXF-4224

Custom HTTP methods (HttpMethod annot) not supported?

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.5.3
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I wanted to save myself some typing and introduce a custom method annotation for use with a response handler:

      @Target(value = METHOD)
      @Retention(value = RUNTIME)
      @HttpMethod(value = POST)
      public @interface POST_create {

      }

      since HATEOS resource creation is done with POST.

      However a method:

      @POST_create
      @Consumes(CONTENT_FORM_URLENCODED)
      @Description(title = "Factory method")
      Dto createSomething( ... );

      is not found as valid resource method.

      When I annotate it with regular POST annot. it works:

      @POST
      @POST_create
      @Consumes(CONTENT_FORM_URLENCODED)
      @Description(title = "Factory method")
      Dto createSomething( ... );

      BTW. While trying to debug this I noticed that the HttpMethod annotation is still recognized as a valid resource method annotation ( c.f. CXF-1007 ) in org.apache.cxf.jaxrs.utils.AnnotationUtils.initMethodAnnotationClasses() line 114

        Activity

        Jakub Bocheński created issue -
        Jakub Bocheński made changes -
        Field Original Value New Value
        Description I wanted to save myself some typing and introduce a custom method annotation like this:
        I wanted to save myself some typing and introduce a custom method annotation for use with a response handler:

        @Target(value = METHOD)
        @Retention(value = RUNTIME)
        @HttpMethod(value = POST)
        public @interface POST_create {

        }

        since HATEOS resource creation is done with POST.


        However a method:

        @POST_create
        @Consumes(CONTENT_FORM_URLENCODED)
        @Description(title = "Factory method")
        Dto createSomething( ... );

        is not found as valid resource method.

        When I annotate it with POST also it works:


        @POST
        @POST_create
        @Consumes(CONTENT_FORM_URLENCODED)
        @Description(title = "Factory method")
        Dto createSomething( ... );


        BTW. While trying to debug this I noticed that the HttpMethod annotation is still recognized as a valid resource method annotation ( c.f. CXF-1007 ) in org.apache.cxf.jaxrs.utils.AnnotationUtils.initMethodAnnotationClasses() line 114


        Jakub Bocheński made changes -
        Description I wanted to save myself some typing and introduce a custom method annotation for use with a response handler:

        @Target(value = METHOD)
        @Retention(value = RUNTIME)
        @HttpMethod(value = POST)
        public @interface POST_create {

        }

        since HATEOS resource creation is done with POST.


        However a method:

        @POST_create
        @Consumes(CONTENT_FORM_URLENCODED)
        @Description(title = "Factory method")
        Dto createSomething( ... );

        is not found as valid resource method.

        When I annotate it with POST also it works:


        @POST
        @POST_create
        @Consumes(CONTENT_FORM_URLENCODED)
        @Description(title = "Factory method")
        Dto createSomething( ... );


        BTW. While trying to debug this I noticed that the HttpMethod annotation is still recognized as a valid resource method annotation ( c.f. CXF-1007 ) in org.apache.cxf.jaxrs.utils.AnnotationUtils.initMethodAnnotationClasses() line 114


        I wanted to save myself some typing and introduce a custom method annotation for use with a response handler:

        @Target(value = METHOD)
        @Retention(value = RUNTIME)
        @HttpMethod(value = POST)
        public @interface POST_create {

        }

        since HATEOS resource creation is done with POST.


        However a method:

        @POST_create
        @Consumes(CONTENT_FORM_URLENCODED)
        @Description(title = "Factory method")
        Dto createSomething( ... );

        is not found as valid resource method.

        When I annotate it with regular POST annot. it works:


        @POST
        @POST_create
        @Consumes(CONTENT_FORM_URLENCODED)
        @Description(title = "Factory method")
        Dto createSomething( ... );


        BTW. While trying to debug this I noticed that the HttpMethod annotation is still recognized as a valid resource method annotation ( c.f. CXF-1007 ) in org.apache.cxf.jaxrs.utils.AnnotationUtils.initMethodAnnotationClasses() line 114


        Sergey Beryozkin made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Sergey Beryozkin [ sergey_beryozkin ]
        Resolution Cannot Reproduce [ 5 ]
        Daniel Kulp made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Sergey Beryozkin
            Reporter:
            Jakub Bocheński
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development