You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org> on 2018/10/17 12:15:00 UTC

[jira] [Comment Edited] (CXF-7834) Using @QueryParam on resource field doesn't work

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

Colm O hEigeartaigh edited comment on CXF-7834 at 10/17/18 12:14 PM:
---------------------------------------------------------------------

I added @RequestScoped but it still worked - it looks like a Weld proxy is not being created.


was (Author: coheigea):
I added @RequestScoped but it still worked.

> Using @QueryParam on resource field doesn't work
> ------------------------------------------------
>
>                 Key: CXF-7834
>                 URL: https://issues.apache.org/jira/browse/CXF-7834
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.15
>         Environment: TomEE 7.0.5 with CXF 3.1.15
>            Reporter: Christian Kaltepoth
>            Assignee: Colm O hEigeartaigh
>            Priority: Major
>         Attachments: cxf-query.tar.gz
>
>
> 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:
> {code:java}
> @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;
>     }
> }
> {code}
> If I move the annotation to the getter, it is working as expected:
> {code:java}
> @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;
>     }
> }
> {code}
> 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" :P



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