hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wilcox, Mark" <Mark.Wil...@webct.com>
Subject RE: content-transfer-encoding issue
Date Fri, 11 Jul 2003 17:04:30 GMT
Ok -- this seems a lot better than rewriting HTTPClient code :).
 
 
Mark

	-----Original Message----- 
	From: Michael Becke [mailto:becke@u.washington.edu] 
	Sent: Fri 7/11/2003 12:55 PM 
	To: Commons HttpClient Project 
	Cc: 
	Subject: Re: content-transfer-encoding issue
	
	

	Mark,
	
	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: commons-httpclient-dev-unsubscribe@jakarta.apache.org
	For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
	
	

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