I'm sorry if this has come up, but the archives are not working at the
moment.

My application writes serialized objects via http to servlets. I have been
doing this using the built in java.net classes like so:
URL url = new URL("http://my.server:8080/myservlet);
URLConnection conn = url.openConnection();
conn.setRequestProperty("Content-type", "application/octet-stream");
conn.setDoOutput(true);
ObjectOutputStream out = new
ObjectOutputStream(conn.getRequestOutputStream());
out.writeObject(anObject);
out.close();

The problem is that when the objects reach a certain size, they often time
out on the server side, leaving the client hanging. I was hoping the apache
httpclient API would be more robust, or at least provide a timeout setting
on the client side.

In the httpclient package, the only way to access an OutputStream that I
have found is in the class HttpConnection. But I am unable to figure out how
to create an HttpConnection with the path to my servlet. It only seems to
have constructors for setting host, port, protocol, etc, but not the path to
the actual servlet ("/myservlet"). Is there a way to create an
HttpConnection with a path beyond the host?

Alternately, I looked at the PostMethod class. I don't understand why the
getRequestBody() method returns an InputStream instead of an OutputStream.
Can I use this class to somehow accomplish what I want to?

Basically, I'm new to this package, and I would like to know if it will help
me accomplish what the code snippet above accomplishes (only without so many
failures). Also, will it help with my timeout problem? Any advice at all is
much appreciated.

Gregg



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to