wink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jay Mann <jmand...@hotmail.com>
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 8.0.0.9.  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 = 
client.resource("http://localhost:9999/Test/service/getUserInfo");

         BufferedOutMultiPart requestEntity = new BufferedOutMultiPart();
         requestEntity.setBoundary(boundary);
         OutPart outPart = new OutPart();
         outPart.setBody(URLEncoder.encode("111", "UTF-8"));
         outPart.addHeader("Content-Disposition", "form-data; 
name=\"cdbId\"");
         requestEntity.addPart(outPart);
         outPart = new OutPart();
         outPart.setBody(URLEncoder.encode("222", "UTF-8"));
         outPart.addHeader("Content-Disposition", "form-data; 
name=\"passwd\"");
         requestEntity.addPart(outPart);

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

Mime
View raw message