You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jason Wang <ja...@bulletin.net> on 2008/06/05 08:07:16 UTC
Regarding the FileUpload project, how to get charset info from FileItemStream?
Hi there,
I just started using the fileupload API to write a REST API a couple of
days ago. Now I run into a problem: I don't know how to get the charset
from uploaded files when using the streaming API.
For example, I can upload files using httpclient library via a
multipart post:
String url = "https://localhost:8040/api/1/sms/out";
PostMethod post = new PostMethod(url);
File smilFile = new File("main.smil");
Part smil = new FilePart(smilFile.getName(),
smilFile,"application/smil","UTF-8"); // the last paramater takes in the
charset.
I noticed that there is a getCharset() method in class DiskFileItem.
Unfortunately, when using the stream api, I should be dealing with the
FileItemStream objects only. Could anyone give any help on this?
Thanks a lot.
Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: Regarding the FileUpload project, how to get charset info from
FileItemStream?
Posted by Jason Wang <ja...@bulletin.net>.
Jason Wang wrote:
> Hi there,
>
> I just started using the fileupload API to write a REST API a couple
> of days ago. Now I run into a problem: I don't know how to get the
> charset from uploaded files when using the streaming API.
>
> For example, I can upload files using httpclient library via a
> multipart post:
>
> String url = "https://localhost:8040/api/1/sms/out";
> PostMethod post = new PostMethod(url);
>
> File smilFile = new File("main.smil");
>
> Part smil = new FilePart(smilFile.getName(),
> smilFile,"application/smil","UTF-8"); // the last paramater takes in
> the charset.
>
> I noticed that there is a getCharset() method in class DiskFileItem.
> Unfortunately, when using the stream api, I should be dealing with the
> FileItemStream objects only. Could anyone give any help on this?
>
> Thanks a lot.
>
> Jason
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
Problem solved. Found the getHeaders method FileItemStream inherits from
an interface. Sorry to spam you all. I should have been figured it
out before dumping an email to the mail list.
Cheers,
Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org