Re: [xSocket-develop] Proxy example - piping data to file
Status: Inactive
Brought to you by:
grro
|
From: <gre...@we...> - 2008-04-25 14:01:12
|
Hi Martin, the HttpServer.setWriteTransferRate() is a unsupported method. Currently throttling is not supported. A built-in throttling support should be available in future versions. Please file a feature request, with your requirements (http://sourceforge.net/tracker/?atid=850945&group_id=169583). Thanks Gregor > -----Ursprüngliche Nachricht----- > Von: "Martin Thelian" <Mar...@gm...> > Gesendet: 25.04.08 08:00:50 > An: gre...@we... > Betreff: Re: [xSocket-develop] Proxy example - piping data to file Hi, > > does configuring the transfer rate via HttpServer.setWriteTransferRate( > ) work with this approach? I've tried to limit the transfer rate to > 5KB/s but currently my test-download uses 200KB/s. > > Martin > > gre...@we... schrieb:Hi Martin, the xSocket Junit test > BodyForwardingTest (http://xsocket.svn.sourceforge.net/viewvc/xsocket/ > xsocket/http/tags/V2_0_alpha4/src/test/java/org/xsocket/connection/ > http/BodyForwardingTest.java) contains a ForwardHandler which shows > you how to control the message/body streaming. One fast way to fetch > the complete message header is to call the toString method ... > HttpResponseHeader resHdr = response.getResponseHeader(); String > hdrCopy = resHdr.toString(); FileChannel fileChannel = new .... > fileChannel.write(...) ... The body data can be fetched by duplicating > the body ByteBuffer : ... ByteBuffer[] data = bodyDataSource. > readByteBufferByLength(available); for (ByteBuffer buf : data) { > fileChannel.write(buf.duplicate()); } dataSink.write(data); ... Take > care with the NonThreaded annotations of the example code. If you are > writing to a file, the handler should run in a multithreaded mode. > The Nonthreaded annotation should be removed. Gregor -----Ursprüngliche > Nachricht----- Von: "Martin Thelian" <Mar...@gm...>Gesendet: > 10.04.08 09:56:16 An: xso...@li...: [ > xSocket-develop] Proxy example - piping data to file Hi, I would like > to use xsocket as described in [1] chapter "3.2 Reusing message > objects - a proxy example" and additionally I would like to pipe the > response-message into a file while transfering it back to the client. > What is the best way to do this? Thanks, Martin [1] http://xsocket. > sourceforge.net/http/tutorial/V2/TutorialHttp.htm-- Psssst! Schon vom > neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx. > net/de/go/multimessenger---------------------------------------------- > --------------------------- This SF.net email is sponsored by the > 2008 JavaOne(SM) Conference Don't miss this year's exciting event. > There's still time to save $100. Use priority code J8TL2D2. http://ad. > doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone__ > _____________________________________________ xSocket-develop mailing > lis...@li...://lists.sourceforge. > net/lists/listinfo/xsocket-develop > > -- Gregor Roth |