Thanks a lot Paul. Last question from my side.
As I said my requirement earlier,
1) I will post my big XML file from my JSP file,
2) REST web service will consume XML file
3) Parse XML file and populate Mysql database.
I am already done till step2.
I will read the XML file as stream using
bp.getEntityAs(InputStream.class) and is there any better way of
parsing XML file apart from SAX,DOM.
I would like to blog this use case once I am done and will send you the
link.
Thanks,
Anil
Paul Sandoz wrote:
>
> Yes, because that is the name of the control and not the name of the
> file that is to be uploaded. If you want the file name you need to
> obtain the "filename" parameter or call:
>
> bp.getContentDisposition().getFileName()
>
> To get the content as a String do:
>
> String s = bp.getEntityAs(String.class)
>
> or to get it as an InputStream do:
>
> InputStream is = bp.getEntityAs(InputStream.class)
>
> Its all in the JavaDoc :-)
>
>
> The sample i sent a link to (which i think you are using) enables
> logging on the server side. So you take a look at the server-side log
> you should see logs like the following:
>
> 2 > POST http://localhost:8080/fileupload/resources/upload/form-data
> 2 > content-length: 662
> 2 > accept-encoding: gzip,deflate
> 2 > referer: http://localhost:8080/fileupload/
> 2 > connection: keep-alive
> 2 > accept-language: en-us,en;q=0.5
> 2 > host: localhost:8080
> 2 > accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> 2 > user-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
> rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
> 2 > content-type: multipart/form-data;
> boundary=---------------------------12441158614839373711807801786
> 2 > cookie: JSESSIONID=65ed0804f6ac7f1c2ee23a950311
> 2 > accept:
> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> 2 > keep-alive: 300
> 2 >
> -----------------------------12441158614839373711807801786
> Content-Disposition: form-data; name="file"; filename="junk.txt"
> Content-Type: text/plain
> JUNK
> -----------------------------12441158614839373711807801786
> Content-Disposition: form-data; name="file"; filename="junk.txt"
> Content-Type: text/plain
> JUNK
> -----------------------------12441158614839373711807801786
> Content-Disposition: form-data; name="file"; filename="junk.txt"
> Content-Type: text/plain
> JUNK
> -----------------------------12441158614839373711807801786
> Content-Disposition: form-data; name="submit"
> upload
> -----------------------------12441158614839373711807801786--
>
> Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>