hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: HTTP CLIENT - Question regarding charset setting in MultipartPostMethod
Date Fri, 24 Feb 2006 14:25:27 GMT
Can you perhaps tell HttpClient that the charset is

"ISO-8859-1"
instead of
ISO-8859-1

Just a thought - might be worth a try.

S.
On 24/02/06, Plainecassagne, Marie Josephe <mplainecassagne@ptc.com> wrote:
> Hello,
>
> I am working for Parametric Technology in France. Parametric Technology
> provides a WEB - Based application : Windchill-PDMLink. This suite is a
> PDM application.
>
> For our customer, Thales, I am developing a proof of concept regarding
> the integration of PDMLink with Cadence (CAD application). In this
> context, I am using  :
> - SOAP to communicate with PDMLink (queries, document creation)
> - HTTPClient to upload files to this server.
>
> The servlet I am talking to with HTTPClient has a bug when it parses a
> multipart header. It expects the header to contain something like :
> charset="ISO-8859-1" while HTTPClient sends charset=ISO-8859-1 (no
> double quotes). I can fix this bug by myself on the servlet but it is
> servlet that is provided by the standard tool and, for a customer, I
> cannot provide this "local" patch.
>
> I have 2 solutions that would work with this servlet :
> - remove the charset setting in the header
> - change the charset setting to ="ISO-8859-1"
> I don't know how I can make it. Can you help me?
>
> I have tested versions 2 and versions 3 of HTTPClient. Both of them send
> the same header : application/octet-stream; charset=ISO-8859-1
>
> Thanks for your help.
>
> Best regards
>
> Marie-Jo Plainecassagne
>
> PS My code wirh HTTPClient 2.0.2 :
>
>     File targetFile;
>     String szURL;
>
>     ...
>
>     URL targetURL = new URL(szURL);
>     MultipartPostMethod filePost = new MultipartPostMethod();
>     filePost.setPath(targetURL.getPath());
>
>     filePost.addParameter(
>       targetFile.getName(),
>       targetFile);
>
>     HttpClient client = new HttpClient();
>           client.getState().setCredentials(
>                   null,
>                   targetURL.getHost(),
>                   new
> UsernamePasswordCredentials(atdmConnection.getUser(),
> atdmConnection.getPassword())
>               );
>           client.startSession(targetURL);
>     int status = client.executeMethod(filePost);
>
>     if (status != 200) {
>           System.out.println(status + "\n" +
> filePost.getResponseBodyAsString());
>           throw new Exception("Unable to upload file. Error = " +
> filePost.getResponseBodyAsString());
>     }
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message