|
From: Raphael S. <rap...@gm...> - 2012-12-17 12:57:39
|
Hi guys,
I have a multipart upload service defined as this:
@POST
@Consumes(MediaTypeExt.MULTIPART_FORM_DATA)
@Produces(MediaTypeExt.TEXT_PLAIN)
public Response postProcesso(final MultipartInput uploadForm) throws
Exception {
And I'm getting the file name:
part.getHeaders().getFirst("Content-Disposition") and the file
content: part.getBody(byte[].class,
null)
The problem is that the file is UTF-8 encoded, but when I get the bytes
from the part body it seems to be converted to another encoding, and I
can't receive the file content properly.
How can I receive a file from multipart post as UTF-8?
Thanks in advance!
|
|
From: Weinan Li <we...@re...> - 2012-12-17 14:07:36
|
Hi Raphael, Which version you are using? I believe multiple form encoding issues have been solved since 2.3.5.Final. Here is the relative issue: https://issues.jboss.org/browse/RESTEASY-723 -- Weinan Li On Monday, December 17, 2012 at 8:57 PM, Raphael Silva wrote: > Hi guys, > > I have a multipart upload service defined as this: > > @POST > @Consumes(MediaTypeExt.MULTIPART_FORM_DATA) > @Produces(MediaTypeExt.TEXT_PLAIN) > public Response postProcesso(final MultipartInput uploadForm) throws Exception { > > > And I'm getting the file name: part.getHeaders().getFirst("Content-Disposition") and the file content: part.getBody(byte[].class, null) > > The problem is that the file is UTF-8 encoded, but when I get the bytes from the part body it seems to be converted to another encoding, and I can't receive the file content properly. > > How can I receive a file from multipart post as UTF-8? > > Thanks in advance! > > > > ------------------------------------------------------------------------------ > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial > Remotely access PCs and mobile devices and provide instant support > Improve your efficiency, and focus on delivering more value-add services > Discover what IT Professionals Know. Rescue delivers > http://p.sf.net/sfu/logmein_12329d2d > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... (mailto:Res...@li...) > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > > |
|
From: Bill B. <bb...@re...> - 2012-12-17 16:16:15
|
If the content-type of the part doesn't have a charset, it will just be
converted to us-ascii...
But, InputPart has a setMediaType method that you can use before the
part is extracted.
inputPart.setMediaType("text/plain;charset=utf-8");
This fix was introduced 2.3.5
On 12/17/2012 7:57 AM, Raphael Silva wrote:
> Hi guys,
>
> I have a multipart upload service defined as this:
>
> @POST
> @Consumes(MediaTypeExt.MULTIPART_FORM_DATA)
> @Produces(MediaTypeExt.TEXT_PLAIN)
> public Response postProcesso(final MultipartInput uploadForm) throws
> Exception {
>
> And I'm getting the file name:
> part.getHeaders().getFirst("Content-Disposition") and the file content:
> part.getBody(byte[].class, null)
>
> The problem is that the file is UTF-8 encoded, but when I get the bytes
> from the part body it seems to be converted to another encoding, and I
> can't receive the file content properly.
>
> How can I receive a file from multipart post as UTF-8?
>
> Thanks in advance!
>
>
>
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
>
>
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Raphael S. <rap...@gm...> - 2012-12-17 16:25:02
|
Thanks.
In my case it was a bit more complex.
I'm using jboss 7.2.0.Alpha.
I tried to update all resteasy modules to 2.3.5.Final, but it didn't work.
So, I rolled it back, and updated only resteasy-multipart-provider to 2.3.5.
I kept all other resteasy modules in version 2.3.3.
It worked. I managed to set the part media type to utf-8 and it did the
trick!
Do you think it's ok to keep it like that?
On Mon, Dec 17, 2012 at 1:30 PM, Bill Burke <bb...@re...> wrote:
> If the content-type of the part doesn't have a charset, it will just be
> converted to us-ascii...
>
> But, InputPart has a setMediaType method that you can use before the
> part is extracted.
>
> inputPart.setMediaType("text/plain;charset=utf-8");
>
>
> This fix was introduced 2.3.5
>
> On 12/17/2012 7:57 AM, Raphael Silva wrote:
> > Hi guys,
> >
> > I have a multipart upload service defined as this:
> >
> > @POST
> > @Consumes(MediaTypeExt.MULTIPART_FORM_DATA)
> > @Produces(MediaTypeExt.TEXT_PLAIN)
> > public Response postProcesso(final MultipartInput uploadForm) throws
> > Exception {
> >
> > And I'm getting the file name:
> > part.getHeaders().getFirst("Content-Disposition") and the file content:
> > part.getBody(byte[].class, null)
> >
> > The problem is that the file is UTF-8 encoded, but when I get the bytes
> > from the part body it seems to be converted to another encoding, and I
> > can't receive the file content properly.
> >
> > How can I receive a file from multipart post as UTF-8?
> >
> > Thanks in advance!
> >
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> > Remotely access PCs and mobile devices and provide instant support
> > Improve your efficiency, and focus on delivering more value-add services
> > Discover what IT Professionals Know. Rescue delivers
> > http://p.sf.net/sfu/logmein_12329d2d
> >
> >
> >
> > _______________________________________________
> > Resteasy-developers mailing list
> > Res...@li...
> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
> >
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
|
|
From: Weinan Li <we...@re...> - 2012-12-18 06:55:44
|
--
Weinan Li
On Tuesday, December 18, 2012 at 12:24 AM, Raphael Silva wrote:
> Thanks.
> In my case it was a bit more complex.
> I'm using jboss 7.2.0.Alpha.
> I tried to update all resteasy modules to 2.3.5.Final, but it didn't work.
>
>
Could you please explain what kind of problem you've met? Maybe I could help you on it.
> So, I rolled it back, and updated only resteasy-multipart-provider to 2.3.5.
>
>
Yes multipart provider have many refactors/fixes in 2.3.5.
> I kept all other resteasy modules in version 2.3.3.
>
> It worked. I managed to set the part media type to utf-8 and it did the trick!
IMO if it worked then it's fine :-) If you've met any other problems please report here and we'll provide help.
>
> Do you think it's ok to keep it like that?
My philosophy is: If it worked, then don't touch it :-)
>
>
>
> On Mon, Dec 17, 2012 at 1:30 PM, Bill Burke <bb...@re... (mailto:bb...@re...)> wrote:
> > If the content-type of the part doesn't have a charset, it will just be
> > converted to us-ascii...
> >
> > But, InputPart has a setMediaType method that you can use before the
> > part is extracted.
> >
> > inputPart.setMediaType("text/plain;charset=utf-8");
> >
> >
> > This fix was introduced 2.3.5
> >
> > On 12/17/2012 7:57 AM, Raphael Silva wrote:
> > > Hi guys,
> > >
> > > I have a multipart upload service defined as this:
> > >
> > > @POST
> > > @Consumes(MediaTypeExt.MULTIPART_FORM_DATA)
> > > @Produces(MediaTypeExt.TEXT_PLAIN)
> > > public Response postProcesso(final MultipartInput uploadForm) throws
> > > Exception {
> > >
> > > And I'm getting the file name:
> > > part.getHeaders().getFirst("Content-Disposition") and the file content:
> > > part.getBody(byte[].class, null)
> > >
> > > The problem is that the file is UTF-8 encoded, but when I get the bytes
> > > from the part body it seems to be converted to another encoding, and I
> > > can't receive the file content properly.
> > >
> > > How can I receive a file from multipart post as UTF-8?
> > >
> > > Thanks in advance!
> > >
> > >
> > >
> > >
> > >
> > > ------------------------------------------------------------------------------
> > > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> > > Remotely access PCs and mobile devices and provide instant support
> > > Improve your efficiency, and focus on delivering more value-add services
> > > Discover what IT Professionals Know. Rescue delivers
> > > http://p.sf.net/sfu/logmein_12329d2d
> > >
> > >
> > >
> > > _______________________________________________
> > > Resteasy-developers mailing list
> > > Res...@li... (mailto:Res...@li...)
> > > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
> > >
> >
> > --
> > Bill Burke
> > JBoss, a division of Red Hat
> > http://bill.burkecentral.com
> >
> > ------------------------------------------------------------------------------
> > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> > Remotely access PCs and mobile devices and provide instant support
> > Improve your efficiency, and focus on delivering more value-add services
> > Discover what IT Professionals Know. Rescue delivers
> > http://p.sf.net/sfu/logmein_12329d2d
> > _______________________________________________
> > Resteasy-developers mailing list
> > Res...@li... (mailto:Res...@li...)
> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li... (mailto:Res...@li...)
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
>
|