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(3).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. 

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. 

Any idea? 

Indu 

Reply via email to