At the moment, the HttpMethod interface has a method getResponseBodyAsStream() that returns an InputStream of the HTTP body.
I need a method that returns the _entire_ HTTP response, including the HTTP headers and body, in a single InputStream.
The reason for this is that I need to pass the InputStream to JavaMail's MimeBodyPart constructor, and MimeBodyPart requires the HTTP headers to properly set the MIME headers.
Currently, what I do is:
* call getResponseHeaders()
* For each element in the array of Headers, add them to a StringBuffer
* Add a \r\n to the StringBuffer after all the headers
* Create a ByteArrayInputStream out of the StringBuffer's String.getBytes()
* Create an SequenceInputStream that includes the ByteArrayInputStream and the result of getResponseBodyAsStream()
As you can see ... it is quite inefficient.
Regards,
John
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
