hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Natarajan_Va...@emc.com
Subject Sending serialized object and stream
Date Fri, 16 May 2008 20:05:20 GMT
Hi All,

I've requirement to send both serialized java object and stream object.
Here is the code that sends serialized object

            ByteArrayOutputStream requestStream = new
ByteArrayOutputStream();
            ObjectOutputStream objectOutput = new
ObjectOutputStream(requestStream);
            objectOutput.writeObject(request);
            objectOutput.close();

            InputStream requestContent = new
ByteArrayInputStream(requestStream.toByteArray());
            if (requestContent != null) {
                post.setRequestEntity(new
InputStreamRequestEntity(requestContent));
            }

We need to optionally send stream object as well. I believe we need to
use multipart request entity. The HC currently supports FilePart and
StringPart. Do we need to write another type of Part like StreamPart to
do so? 

Help is appreciated.

Thanks in advance

Valli

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message