On Mon, 2012-05-21 at 17:13 +0300, Emilian Utma wrote: > Hello, > > Thank you for your quick reply. > > This is indeed a solution but I'm afraid it won't solve my problem (sorry, > I wasn't very specific in my issue). Unfortunately I don't have access to > the inputStream, I can only expose the outputstream (as a > WritableByteChannel) to the other application because the writing is > provided by it. If I use the HttpEntity interface then I have to modify > that application to implement HttpEntity ... which is not possible ... > > Thank you anyway. > > Best regards, > Emil >
Emil It is a conscious design decision to not expose the underling socket and its input and output streams to HttpClient API consumers. This enables HttpClient to ensure that persistent connections are always in a consistent state when kept alive. You still have an option of dropping to HttpCore and implementing your own HTTP connection API while still re-using framework's transport and connection pooling capabilities. Oleg > P.S. I'm trying to implement a some kind of "HttpContentWriter" module in a > ECM framework where all the content of documents (e.g. files) will be > uploaded on a storage device using HTTP protocol. > > On Mon, May 21, 2012 at 4:12 PM, Mark Claassen <[email protected]> wrote: > > > It is pretty easy to make your own HttpEntity. There are just a few > > methods. You can just implement this interface to wrap > > whatever object you are dealing with. Then in the writeTo method, you can > > read from your stream and write it out right away. > > > > -----Original Message----- > > From: Emilian Utma [mailto:[email protected]] > > Sent: Monday, May 21, 2012 8:55 AM > > To: [email protected] > > Subject: HttpClient API - upload files using OutputStream not Filepart > > > > Hello, > > > > I want to know if is possible to upload a file which its content is set > > via a java.io.OutputStream (as in "old times" when using > > java.net.HttpURLConnection) not > > org.apache.commons.httpclient.methods.multipart.FilePart.Filepart. > > > > I need this behaviour because the content is provided by another > > application not mine. To save the content in a "temp" zone is not > > an option because it is possible to receive hundreds of files per seconds > > ... and this will require a "big temp". > > > > Thank you in advance. > > > > Best regards, > > Emil > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
