Hey all -
Calls to forward() will invoke the complete awake/respond/sleep cycle
within the outer awake/respond/sleep cycle of the parent transaction.
This means that if a servlet forwards a request to another servlet, then
the session will be awakened twice and put to sleep twice (or more
depending on the number of forward calls). This was causing some issues
in our application because we use database sessions, but it would apply
to anyone using the SessionFileStore as well.
The issue is that the session is saved after every forward call, and
might not be in an appropriate state to start another transaction, but
another request can come in before the parent transaction puts the
session to sleep for the final time (e.g. user with two browsers open,
or double-clicking, etc). I have handled this in our application by
keeping an "awakened" count on the session object, and ensuring that the
session is only put to sleep when the awakened count is 0, e.g. when the
final sleep() has been called.
It would be pretty straightforward to integrate the awakened count into
Webware's default session management options, but that would be changing
functionality. I can't see how anyone would be relying on the current
behavior, but you never know ...
Has anyone else encountered this? Do you think it's an issue to be
handled within Webware or left up to the application developer?
Regards - Ben