wink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jay Mann <>
Subject [wink client] Wrong content-lenth when using outMultiPart
Date Sat, 31 Jan 2015 16:23:33 GMT
I'm using the apache wink that is packaged with websphere  I 
believe it is version 1.1.1.  I'm trying to send a multipart request 
from the wink client but it's setting the content-length to 239 when it 
should be 247.  It seems like it is treating the "\r\n" new lines as a 
single byte.  Here is the code.  I tried to specifically set the 
content-length in the resource header but it is overridden.  Since this 
is included in websphere i can really update the jar. Is there a workaround?

Any help is appreciated, thanks.

         RestClient client = new RestClient();
         Resource resource = 

         BufferedOutMultiPart requestEntity = new BufferedOutMultiPart();
         OutPart outPart = new OutPart();
         outPart.setBody(URLEncoder.encode("111", "UTF-8"));
         outPart.addHeader("Content-Disposition", "form-data; 
         outPart = new OutPart();
         outPart.setBody(URLEncoder.encode("222", "UTF-8"));
         outPart.addHeader("Content-Disposition", "form-data; 

         ClientResponse string = resource.header("Content-Type", 
"multipart/form-data; boundary=" + boundary).header("Content-Length", 
"247").header("Connection", "keep-alive").post(requestEntity);

View raw message