cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Indumuni Abeyaratna <>
Subject Throw Exception when there is a semicolon in header parameter value
Date Wed, 02 Jun 2010 03:34:40 GMT
Hi All, 

I am getting below exception when I am trying to download a file using our API which uses

java.lang.IllegalArgumentException: Wrong media type parameter, seperator is missing 
at org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.fromString(

at org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.fromString(

Further debugging I found out it cause by semicolon in the file name. 

Below is the test case to reproduce this, 

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. 

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? 


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message