users@jersey.java.net

POST FormData

From: Saavedra, Gisella <gsaavedra_at_navis.com>
Date: Mon, 22 Jun 2009 13:49:18 -0700

Re: INFO: Initiating Jersey application, version 'Jersey: 1.1.0-ea

 

 

I have a REST service with a parameter of type List<String>.

 

@POST

    @Produces("application/octet-stream")

    @Consumes("application/x-www-form-urlencoded")

    public Response getLogBundle(@FormParam("fromMillis") Long inFromMillis,

                                 @FormParam("toMillis") Long inToMillis,

                                 @FormParam("fileList") List<String> inFileList) {

...

}

 

At the client side, when I am building the FormData, I call

   formData.add("fileList", inNamedLogs);

where inNamedLogs is a List<String>

 

See the value of my formDataàfileList argument (you can see the source and how it has been saved). There are TWO [[ surrounding the value.

 

 

 

On the server side, getLogBundle() (code above), when I see the contents of fileList, I see each element having ONE [ surrounding the value.

So, when I do inFileList.get(0), I get "[C:\\N4\\sandbox...]" instead of "C:\\N4\\sandbox..."

 

Is this a bug? The documentation for the FormParam tag says that List<T> is supported; in this case T is String. I believe steps 1 to 4 of the JavaDoc are satisified.

 

Please advise. Thanks.

 

Gisella Saavedra
Sr. Software Engineer
gsaavedra_at_zebra.com <mailto:gsaavedra_at_zebra.com>

        
 

1000 Broadway, Suite 150, Oakland, CA 94607 | T+1 510 267 5123 T Main+1 510 267 5000 F+1 510 267 5100 | http://www.zebra.com/zes <http://www.zebra.com/zes>



        

 

 






image001.gif
(image/gif attachment: image001.gif)

image002.png
(image/png attachment: image002.png)