Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7834

Using @QueryParam on resource field doesn't work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Reopened
    • Major
    • Resolution: Unresolved
    • 3.1.15
    • None
    • JAX-RS
    • None
    • TomEE 7.0.5 with CXF 3.1.15

    • Unknown

    Description

      Hi,

      I'm currently working on the JSR-371 (MVC 1.0) TCK and ran into a weird issue when running it against TomEE 7.0.5 which include CXF 3.1.15.

      For some reason @QueryParam doesn't work if I place it on a resource field. To be more concrete, in this code the query parameter isn't injected into the field:

      @Path("inject-test")
      public class InjectParamsController {
      
          @QueryParam("fieldValue")
          private String fieldValue;
      
          @GET
          public Response get() {
              // some resource code
          }
      
          public String getFieldValue() {
              return fieldValue;
          }
      
          public void setFieldValue(String fieldValue) {
              this.fieldValue = fieldValue;
          }
      }
      

      If I move the annotation to the getter, it is working as expected:

      @Path("inject-test")
      public class InjectParamsController {
      
          private String fieldValue;
      
          @GET
          public Response get() {
              // some resource code
          }
      
          @QueryParam("fieldValue")
          public String getFieldValue() {
              return fieldValue;
          }
      
          public void setFieldValue(String fieldValue) {
              this.fieldValue = fieldValue;
          }
      }
      

      Both ways work fine on Glassfish5 and Wildfly.

      It would be great to get your thoughts on this. Something like "Yeah, this is a known bug" or perhaps "You are crazy, this MUST work, you are doing something wrong" 

      Attachments

        1. cxf-query.tar.gz
          6 kB
          Colm O hEigeartaigh

        Activity

          People

            coheigea Colm O hEigeartaigh
            chkal Christian Kaltepoth
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: