Hi
Sorry for the misleading subject, it was the error I encountered earlier. forgot the @PathParam("") in the method.Gabo Manuel wrote:Hi all, I am currently trying to have the following work. Initially I have a service as follows: @GET @Path("/search/{whereCondition}/{sortString}/{startingRow}/{lastRow}") @ProduceMime("application/xml") public Accounts getList( @PathParam("") SearchFilter sf ) { return super.getList(sf); } Since there is no means to add a body to an HTTP GET, I used the field injection using @PathParam. I had the SearchFilter file annotated as follows: @PathParam("whereCondition") private String whereCondition;
<snip/> You don't need to put @PathParam-annotate inidividual fileds in a bean like SearchFilter, just having proprty setters will do.
I'm trying to follow the example in (http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html). The code works perfect when I access /search/mywhere/mysort/1/10. I am also wondering if it is possible for the parameters to have defaults, i.e. the service to become accessible if lastRow is omitted. e.g. /search/mywhere/mysort/1 would still be accessible with lastRow defaulting to 10. As per user's guide, @DefaultValue is only useable for @QueryParam,
I think @DefaultValue can now be applied to any JAXRS-annotated method parameter, be it @PathParam or @QueryParam or @HeaderParam, can please give it a try ? I need to verify but I reckon putting @DefaultValue either on the the method itself (applies to all parameters) or on the class resource (applies to all resource methods) should work too - but I don't rememeber at the moment
however, injecting the values to object fields is only applicable to @PathParam. Is it possible to have @QueryParam inject to object fields?
Yes, same should be possible for QueryParams, this CXF extension is supported for PathParam and QueryParam but can easily be extended to support HeaderParams, etc
Cheers, Sergey
As of the moment, the only work-around I could think of is avoid the use of object in GET and have everything as @QueryParam. Again, my thanks. Gabo ------------------------------------------------------------------------ No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.175 / Virus Database: 270.8.5/1757 - Release Date: 10/30/2008 2:35 PM
