hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Plainecassagne, Marie Josephe" <mplainecassa...@ptc.com>
Subject HTTP CLIENT - Question regarding charset setting in MultipartPostMethod
Date Fri, 24 Feb 2006 13:59:05 GMT
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());
    }


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