java - How to work with long-lasting http requests -
i have long-lasting http request (a lot of computation in back-end).
currently it's synchronous, while server computer, browser doesn't see output/result. after while, connection dropped , timeout error displayed in browser.
i'd return info browser right away, , make wait result. how achieve this?
please note, java back-end synchronous. solution require hack in servlet/front end possibly requiring javascript requests.. ?
you want use comet pattern. it's ajax pattern, featuring long-held http requests simulate feed. see here detailed explanation.
basically, fire off request, server holds it, replies when has of interest. @ point of receiving reply, fire off long-held request.
this time-sequence makes feel feed.
in case, return "yeah, i'm working on it" , reply "still processing 10% done dude" , on until "done".
things node.js @ implementing kind of functionality.
although, you're using synchronous java end, may need kind of indication somewhere progress being made. possibly database.
Comments
Post a Comment