Hey, 2010/11/10 u.nn <[email protected]>: > I'm looking at using libwt, but there's something I'd like to be able to > do that I'm not seeing in the documentation. I'm new to libwt and all, > so feel free to correct whatever may be wrong in the following. > > I think, normally when the WApplication constructor is called or some > signal callback is called, the application code adds various widgets and > whatnot, and then the callback or constructor returns, the page is > rendered and sent to the client (or for AJAX clients, the screen updates > are sent, etc).
Yes this is what we describe as the normal event loop behavior. > What I would like, however, is the ability to postpone rendering or data > being pushed to the client until some other data is received. For > instance, if I want to wait until receiving data from a file descriptor > for some database connection or an authentication service, etc etc, I'd > like to be able to hand that file descriptor to the event loop that > libwt is using, and have some callback or something called from there. I > figure I can do that by hooking in to the io_service in > http::server::Server or whatever it's called, but this doesn't really > help if the response has already been pushed out. Given that you insist on being able to do this with plain HTML as well, I guess Wt does indeed not support this. Although Wt uses an asynchronous model for I/O (for http and isapi connectors), it currently uses a synchronous model for delivering an event and rendering the response. Can I ask why you really want this, since deferring the response to the browser for a plain HTML request is usually going to give rather bad user experience ? > I'm not sure if I'm just bad at browsing the documentation, but I > haven't found it. I am fairly certain that I am _not_ looking for > enableUpdates()-style server-initiated updates or "comet"-style events, > because I want to be able to do this without requiring AJAX. For plain > HTML requests (at least), I just want to delay sending the page to the > client until I have received all of the data I need, without blocking > the current thread. > The closest thing I have found to what I want looks like > Wt::Http::Response's createContinuation() method, but I don't see much > documentation that makes it clear how to use it. I get the feeling, > though, that this is intended for when an application is dynamically > generating some document (like a PDF or an image or something), and not > for general UI rendering, but I could be way off. That is entirely correct. > And if this does not yet exist in wt, would there be opposition to > adding something like this? I can only see it being marginally useful, but on the other hand, it should not be hard because Wt already has the necessary low level concepts in place to do this (i.e. to defer responding to an incoming request). It seems that you have been roaming the source code anyway, so I could put you on the right track to implement this and and help in finishing up ? As to the API, I believe we would need to add a DeferredRender class with a single method render(), which is returned from WApplication::deferRender(); Regards, koen ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
