Another option is to create sub-classes of FilePart and StringPart that override getTransferEncoding() and getContentType(). Something like:
class FilePartNoTransferEncoding extends FilePart {
public FilePartNoTransferEncoding(String name, PartSource partSource) {
super(name, partSource);
}
public String getTransferEncoding() {
return null;
} public String getContentType() {
return null;
}
}class StringPartNoTransferEncoding extends StringPart {
public StringPartNoTransferEncoding(String name, String value) {
super(name, value);
} public String getTransferEncoding() {
return null;
} public String getContentType() {
return null;
}
}Then you will want to use these when adding parts to the MultiPartPostMethod. So instead of doing this:
MultiPartPostMethod method = new MultiPartPostMethod(); File f = someFile;
method.addParameter("paramName", f);
method.addParameter("paramName", "paramValue");
You would do"
method.addPart(new FilePartNoTransferEncoding("paramName", new FilePartSource(file));
method.addParameter(new StringPartNoTransferEncoding("paramName", "paramValue"));
Mike
Wilcox, Mark wrote:
I'm sending a multi-part form and that's ok, but the remote server is choking on Content-Disposition: form-data; name="FILENAME"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
26722
Specifically it's trying to process Content-Tranfer-Encoding: 8bit\r\n\r\n26722 as the value of the parameter - "FILENAME" . I realize this is probably a bug on the server side, but I can't get that fixed at the moment.
Is there a way to not send the content-tranfser-encoding value?
Mark
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
