From: Manish G. <tin...@ou...> - 2015-11-19 13:55:33
|
I am developing an application that mobilizes an old legacy web application. Frontend is developed using JQueryMobile/backbone etc. The backend server piece uses HTMLUnit to connect to the legacy application, transforms the data and presents to the frontend in JSON. The results so far have been great. Currently, I fire up a webclient for each action called in struts. I save WebClient cookies in session to retrieve them in subsequent request and assign them to newly created webclient for a user session. I also tried saving the whole webclient as part of struts session, and tried to re-use it again on subsequent request, it failed sometimes. However, this approach will not probably work when I roll this out to users (around 1200). I was thinking about creating a WebClient pool using Apache's Commons Object Pool library. And, use it by getting a webclient from pool, use it and return it back to pool on each request. I plan to store HTMLPage in the session. I can associate cookies stored in the session with webclient fetched from the pool. The question really is, how do I associate HTMLPage that is stored in the session with the newly fetched webclient? for e.g.: I open a page, click on a button that executes javascript and changes content on the page. I take this content and present it to front end. On the subsequent struts request, webclient needs to act on the page saved in the session. Am I doing this right? Would appreciate any help in this regard. Thanks |