Hi Gisella,
are you sure you're not just misinterpreting the output of your debugger?
As far as I can see from your explanation and the screenshot, it should
be all perfectly fine.
Your debugger displays the items of Java collections in square brackets
("[" and "]").
So
| fromMillis -> [1234567890]
means that your HashMap contains an entry with the key "fromMillis" and
the value "1234567890".
| fileList -> [[C:\\N4\\sandbox...]]
accordingly means that your HashMap contains an entry with the key
"fileList" and that the value is a List which contains the value
"C:\\N4\\sandbox...". Thus the two pairs of square brackets.
If your List contained another Collection, you could also get something like
| fileList -> [[[foo], [bar]], [[foo2], [bar2]]]
If you anticipate to only get a flat string value (e.g. comma-separated)
for inFileList, you should not declare it as List<String> but as String.
HTH,
Jochen
Saavedra, Gisella wrote:
> 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>_
>
>
>
> http://www.navis.com/images/spacer.gif
>
> 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_
>
>
>
>
>