Hi
On 07/12/11 18:10, Dan King wrote:
Does anyone know why I'm unable to map query parameters via @QueryParam to
an object? For example, if I enter:

http://127.0.0.1/search?term=java&max=10&offset=10

Only the "term" parameter is captured. Below are the relevant pieces
of code.


@Path("/search")
public class SearchService {
   ...
   ...
     @GET
     @Path("")
     @Transactional
     public Response search(@QueryParam("") SearchQuery query) {
       ...

     }
}

public class SearchQuery {

     private String term;
     private Integer zipCode;
     private Integer range;
     private Collection<String>  types;
     private Integer max;
     private Integer offset;

     ...
     // Getters and Setters for the above properties


}

Sorry, I forgot to mention I'm using CXF JAX-RS version 2.4.2.


That works for me, we have an existing test where Long is used instead of Integer, works fine. I can't imagine why, may be @Transactional affects it, please remove and check if that the case; also how do setters for max & offset look like ?

Cheers, Sergey

-Dan



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to