You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2010/06/02 23:27:18 UTC

Re: Throw Exception when there is a semicolon in header parameter value

Hi

On Wed, Jun 2, 2010 at 4:34 AM, Indumuni Abeyaratna
<ia...@aconex.com>wrote:

> Hi All,
>
> I am getting below exception when I am trying to download a file using our
> API which uses CXF.
>
> java.lang.IllegalArgumentException: Wrong media type parameter, seperator
> is missing
> at
> org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.fromString(MediaTypeHeaderProvider.java:65)
> at
> org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.fromString(MediaTypeHeaderProvider.java:31)
>
> Further debugging I found out it cause by semicolon in the file name.
>
> Below is the test case to reproduce this,
>
> @Test
> public class MediaTypeHeaderProviderTest {
>
> public void testHeaderFileName() {
>
> String fileName ="version_2006&#65288;3&#65289;.pdf";
> String header = "application/octet-stream; name=\"%s\"";
>
> MediaTypeHeaderProvider provider = new MediaTypeHeaderProvider();
>
> provider.fromString(String.format(header, fileName));
>
> }
> }
>
>
> Look to me it is a issue in CXF itself since this seems to handle by tomcat
> (we can download this file by browser via web app) . I could be wrong.
>
> does look like a bug in CXF, I thought when this it was reported earlier on
that the media type parameter had no value. thanks for providing the test


> I tried URL encoding of the file name prior to add that to the header but
> then I am getting client side UTF-8 encoding exception.
>
> How did you do it ? Is CXF involved ?

cheers, Sergey


> Any idea?
>
> Indu
>