From: Francois-Xavier B. <fra...@ce...> - 2015-03-24 16:32:21
|
Hi Augustus, I have integrated your patch into the trunk. It works fine. Thank you very much for your contribution! 2014-10-20 18:03 GMT+02:00 Francois-Xavier Bonnet < fra...@ce...>: > Thank you very much for the code snippets. > I created an issue for that in Github. I will try to see if I can > integrate it. > https://github.com/esigate/esigate/issues/33 > > 2014-10-16 10:44 GMT+02:00 謝福明 <aug...@ch...>: > >> Hi, >> >> >> >> We have resolved this issue, >> >> >> >> Because InputStreamEntity writeTo() have to waiting buffer full >> then write output, but our apps use long-polling transfers data never fill >> up the buffer, cause InputStreamEntity waiting until timeout, >> >> >> >> So, >> >> 1. We add writeTo() in org.esigate.http.HttpResponseUtils, which >> reference org.apache.http.entity.InputStreamEntity writeTo() method >> >> 2. insert outstream.flush() code after each outstream.write(buffer, >> 0, l) method, >> >> 3. modify org.esigate.servlet.HttpServletMediator >> httpEntity.writeTo(os) to >> HttpResponseUtils.writeTo(httpEntity.getContentLength(), >> httpEntity.getContent(), os); >> >> >> >> code snippets as below: >> >> *org.esigate.http.HttpResponseUtils * >> >> >> >> *public* *static* *void* writeTo(*long* length, InputStream content, >> OutputStream outstream) *throws* IOException { >> >> *if* (outstream == *null*) { >> >> *throw* *new* IllegalArgumentException("Output stream may not >> be null"); >> >> } >> >> >> >> InputStream instream = content; >> >> *try* { >> >> *byte*[] buffer = *new* *byte*[2048]; >> >> >> >> *if* (length < 0L) { >> >> *int* l; >> >> *while* ((l = instream.read(buffer)) != -1) { >> >> outstream.write(buffer, 0, l); >> >> outstream.flush(); >> >> } >> >> } >> >> >> >> *long* remaining = length; >> >> *while* (remaining > 0L) { >> >> *int* l = instream.read(buffer, 0, (*int*) Math.*min*(2048L, >> remaining)); >> >> *if* (l == -1) { >> >> *break*; >> >> } >> >> outstream.write(buffer, 0, l); >> >> outstream.flush(); >> >> remaining -= l; >> >> } >> >> } *finally* { >> >> instream.close(); >> >> } >> >> >> >> } >> >> >> >> >> >> org.esigate.servlet.HttpServletMediator >> >> *public* *void* sendResponse(HttpResponse httpResponse) *throws* >> IOException { >> >> . >> >> . >> >> . >> >> . >> >> *try* { >> >> ServletOutputStream os = response.getOutputStream(); >> >> // httpEntity.writeTo(*os*); >> >> HttpResponseUtils.*writeTo*(httpEntity.getContentLength(), >> httpEntity.getContent(), os); >> >> } *catch* (IOException e) { >> >> *LOG*.warn("Error while sending the response", e); >> >> EntityUtils.*consume*(httpResponse.getEntity()); >> >> } >> >> } >> >> } >> >> >> >> >> >> >> >> >> >> >> >> *From:* fx....@gm... [mailto:fx....@gm...] *On Behalf Of *Francois-Xavier >> Bonnet >> *Sent:* Tuesday, September 30, 2014 1:00 AM >> *To:* 謝福明 >> *Cc:* Francois-Xavier Bonnet; web...@li... >> >> *Subject:* Re: [EsiGate-users] long-polling in esigate 4.1 problem >> >> >> >> Hi, >> >> >> >> How do you plan to use HttpAsyncClient? Are you going to migrate EsiGate >> to HttpAsyncClient or write your own custom proxy servlet just for your >> long polling requests? >> >> How can I help you? >> >> >> >> 2014-09-29 10:59 GMT+02:00 謝福明 <aug...@ch...>: >> >> >> >> Hi, >> >> >> >> “for a small response you may have to wait until the end of the >> response to get the last packet”. Yes, we are encountering this problem… >> >> >> >> We decided to use HttpAsyncClient to resolve this problem, do you >> have any suggestions? >> >> >> >> >> >> Thank you. >> >> *From:* fx....@gm... [mailto:fx....@gm...] *On Behalf Of *Francois-Xavier >> Bonnet >> *Sent:* Wednesday, September 24, 2014 9:54 PM >> *To:* Francois-Xavier Bonnet >> *Cc:* 謝福明; web...@li... >> *Subject:* Re: [EsiGate-users] long-polling in esigate 4.1 problem >> >> >> >> I just had a look at the code. I can confirm that we are streaming >> directly all non parsable responses but there might be a buffer issue: >> currently it is flushed only when the buffer is full. So for a big >> response, the response is streamed in packets which size depends on the >> servlet container buffer size but for the last packet or for a small >> response you may have to wait until the end of the response to get the last >> packet. >> >> >> >> I guess this could explain the problem you have. >> >> >> >> Unfortunately this behavior cannot be changed easily because current >> EsiGate version is based on Apache HttpClient, this implementation is using >> blocking IO. I think we might be able to fix this after migrating to >> HttpAsyncClient using event based content streaming like in this example >> <https://hc.apache.org/httpcomponents-asyncclient-dev/httpasyncclient/examples/org/apache/http/examples/nio/client/AsyncClientHttpExchangeStreaming.java> but >> this is planned for EsiGate 6.0 >> >> >> >> Feel free to open a bug report. Contributions are also always very much >> appreciated. >> >> >> >> 2014-09-24 14:41 GMT+02:00 Francois-Xavier Bonnet < >> fra...@ce...>: >> >> Hi Augustus, >> >> >> >> For content types like text/html and application/xhtml+xml, EsiGate is >> buffering the complete response in order to parse it for ESI tags. You can >> override this with "parsableContentTypes" property. >> >> For all other content-types, EsiGate is streaming directly the response >> to the browser. >> >> What is the content-type header of the response you want to stream ? >> Which application server are you using (there are some differences in the >> way internal buffers work) ? What are the other response headers related to >> the cache (Cache-control, Expires, Last-Modified, E-Tag) ? >> >> >> >> 2014-09-24 12:01 GMT+02:00 <aug...@ch...>: >> >> Hi, >> >> Dose esigate 4.1 can run in streaming mode?? It’s like fiddler >> streaming mode >> >> >> >> >> >> We have problem when we use long-polling in esigate 4.1, >> >> >> >> user click execute button, long-polling will create channel >> between client browser and backend Ap server through esigate, >> >> >> >> when channel is created, client browser will communicate with backend Ap >> server, >> >> >> >> but it work always when esigate socketTimeout or websocket timeout, >> >> >> >> we found this problem in org.esigate.servlet.HttpServletMediator >> line 193, >> >> >> >> when we click execute button, esigate will stop in >> org.esigate.servlet.HttpServletMediator line 193 until it timeout, then work >> >> >> >> seems like esigate is waiting long-polling close, then it start >> do response to client >> >> >> >> recently, we use fiddler access the app, it’s pending like >> esigate, but when fiddler run in streaming mode, it’s works fine! >> >> >> >> So, esigate have streaming mode?? >> >> >> >> >> >> Thank you >> >> >> >> >> >> >> >> >> >> >> *本信件可能包含中華電信股份有限公司機密資訊,非指定之收件者,請勿蒐集、處理或利用本信件內容,並請銷毀此信件. >> 如為指定收件者,應確實保護郵件中本公司之營業機密及個人資料,不得任意傳佈或揭露,並應自行確認本郵件之附檔與超連結之安全性,以共同善盡資訊安全與個資保護責任. >> Please be advised that this email message (including any attachments) >> contains confidential information and may be legally privileged. If you are >> not the intended recipient, please destroy this message and all attachments >> from your system and do not further collect, process, or use them. Chunghwa >> Telecom and all its subsidiaries and associated companies shall not be >> liable for the improper or incomplete transmission of the information >> contained in this email nor for any delay in its receipt or damage to your >> system. If you are the intended recipient, please protect the confidential >> and/or personal information contained in this email with due care. Any >> unauthorized use, disclosure or distribution of this message in whole or in >> part is strictly prohibited. Also, please self-inspect attachments and >> hyperlinks contained in this email to ensure the information security and >> to protect personal information.* >> >> >> >> >> ------------------------------------------------------------------------------ >> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer >> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports >> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper >> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer >> >> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk >> _______________________________________________ >> Webassembletool-users mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/webassembletool-users >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Slashdot TV. Videos for Nerds. Stuff that Matters. >> >> http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk >> _______________________________________________ >> Webassembletool-users mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/webassembletool-users >> >> >> >> >> ------------------------------------------------------------------------------ >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> http://p.sf.net/sfu/Zoho >> _______________________________________________ >> Webassembletool-users mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/webassembletool-users >> >> > |