hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Becke <be...@u.washington.edu>
Subject Re: HTTPClient hangs
Date Fri, 05 Mar 2004 03:10:46 GMT
Hi Arun,

It seems that the server never responds to the request.  My only guess 
is that it's related to inconsistencies with how different servers 
handle multi part posts.  In particular, some servers seem to have 
trouble with content-type and transfer encoding.  Please try setting 
both of these values to null for each of the string and file parts 
being posted.

Mike

On Mar 4, 2004, at 12:09 PM, Arun G wrote:

> Hi folks,
>     I am using multipart form post to upload a file.
> The server side is production code that we are using
> to upload files with other modules using multipart
> form post. The failure/hang is happening only with the
> HTTP Client code that I have pasted here. Also it is
> worth noting that the server does a redirect after the
> file is uploaded. But I don't even the response code
> back since it just seems to stiing there at the
> executemethod call. I was wondering if someone could
> help me figure out what may be wrong here.
>
> The executemethod never returns. From the trace it
> looks like the the function HTTPParser.readRawLine
> does not return. Here are the last few lines of the
> trace and the source code that is being used. I am
> running this under the following JVM version :
>
> java version "1.4.1_06"
> Java(TM) 2 Runtime Environment, Standard Edition
> (build 1.4.1_06-b01)
> Java HotSpot(TM) Client VM (build 1.4.1_06-b01, mixed
> mode)
>
> 004/03/04 09:02:49:148 PST [TRACE] HttpConnection -
> -enter HttpConnection.flushRequestOutputStream()
> 004/03/04 09:02:49:158 PST [TRACE] HttpMethodBase -
> -enter HttpMethodBase.readResponse(HttpState,
> HttpConnection)
> 004/03/04 09:02:49:158 PST [TRACE] HttpMethodBase -
> -enter HttpMethodBase.readStatusLine(HttpState,
> HttpConnection)
> 004/03/04 09:02:49:158 PST [TRACE] HttpConnection -
> -enter HttpConnection.readLine()
> 004/03/04 09:02:49:158 PST [TRACE] HttpParser - -enter
> HttpParser.readLine()
> 004/03/04 09:02:49:158 PST [TRACE] HttpParser - -enter
> HttpParser.readRawLine()
>
>
> HttpClient httpClient = new HttpClient();
>         MultipartPostMethod multipartPostMethod = new
> MultipartPostMethod(urlString);
>         java.util.Enumeration formEnum =
> formVariableHash.keys();
>         while (formEnum.hasMoreElements())
>         {
>             String name = (String)
> formEnum.nextElement();
>             String value =
> formVariableHash.get(name).toString();
>             StringPart stringPart = new
> StringPart(name, value);
>             multipartPostMethod.addPart(stringPart);
>         }
>         try
>         {
>             FilePart filePart = new
> FilePart("file_to_upload", binaryFile.getName(),
> binaryFile);
>             multipartPostMethod.addPart(filePart);
>             if (!multipartPostMethod.validate())
>             {
>                 throw new FileuploadException("Unable
> to upload File " + uploadFileName + ". Error when
> posting form information");
>             }
>             int responseCode =
> httpClient.executeMethod(multipartPostMethod);
>             ArenaApp.getInstance().logMessage("File
> upload responseCode= " + responseCode);
>                     }
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Search - Find what youÂ’re looking for faster
> http://search.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
>


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


Mime
View raw message