You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Doal Miller <dm...@syntricity.com> on 2002/01/24 02:07:16 UTC

Trying to throw requests received while a request is in progress

Greetings, I am not sure this is a Turbine issue, so if it isn't perhaps
someone could point me in the right direction.

We have extended the VelocityPage to implement a simple state machine and
therefore, control the transitions from one screen to another based on the
current screen and the action in the URL. What I want to do is throw away
any requests received while processing a request. So if a user presses a
button, and while that action is being processed, they press another button,
I want to just ignore the second request. IOW I want to prevent any type
ahead.

The solution I have implemented is to provide a locking mechanism based on
our UserSession. When a request enters MyVelocityPage.doBuildBeforeAction it
acquires the lock. If the UserSession is already locked this request is
flagged to be thrown away, a do nothing action is executed, and when this
request enters MyVelocityPage.doBuildAfterAction, I do:

	data.setStatusCode(HttpServletResponse.SC_NO_CONTENT);

Then when the first request that got the lock finishes processing in
MyVelocityPage.doBuildAfterAction it releases the lock so the next request
can get it.

Everything seems to work fine and the current screen stays on the browser
while processing the first request. However, when the original request
completes, I never see the new screen that it has set. I stepped through the
Turbine code to see that nothing is having a problem. It appears that it is
going through the motions of writing the output to the page but I never see
it in the browser. The following code in Turbine's doGet routine is
executed, the status code is 200 which is SC_OK, data is representing the
correct screen, and the output operation seems to go fine.

      // Set the status code.
      data.getResponse().setStatus ( data.getStatusCode() );
      // Output the Page.
      data.getPage().output (data.getOut());

Any advise or suggestions would be welcomed. Does what I am doing seem
correct? It does to me anyway, but then it doesn't work. Thanks for any help
you can provide.

Doal Miller


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>