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;
   @PathParam("sortString")
   private String sortString;
   @PathParam("startingRow")
   private long startingRow;
   @PathParam("lastRow")
   private long lastRow;
   //it has setters down the code...

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, however, injecting the values to object fields is only applicable to @PathParam. Is it possible to have @QueryParam inject to object fields?

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

Reply via email to