wink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luciano Resende <luckbr1...@gmail.com>
Subject Re: [wink client] Wrong content-lenth when using outMultiPart
Date Sat, 31 Jan 2015 21:42:18 GMT
Can you reproduce the problem with the latest wink release ? If not, you
can try deploying the wink jars with your application and setting the class
loader to be parentLast in websphere when deploying the application.

On Sat, Jan 31, 2015 at 8:23 AM, Jay Mann <jmandawg@hotmail.com> wrote:

> 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);
>



-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Mime
View raw message