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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to