Does your original page initially re-direct to the servlet, or just
attempt to access it as part of the original request?
If I am understanding this correctly, I have seen a similar type of
problem...such as a request that requires extensive processing, where
the browser session also does not limit it to a single request (ie the
user hammers on the submit button) then the work might be completed by
the initial request, but it will not be able to perform a re-direct as
the browser session is only interacting with its most recent request...
the most recent request can re-direct, but not any of the previous
requests (from the same form).
To solve this I basically had to write some synchronized code (within
turbine)... allowing some initial request to perform the work, while at
the same time allowing subsequent requests (to the same action and code)
to recognize that the work was already complete and attempt to take the
appropriate action... such as re-directing to an appropriate form.
(Yes I know how to solve this within the browser using Javascript, but
in this instance it was not an
option)
The interesting thing about this is that all of the requests ARE able to
display console output, but only the last request can re-direct...
You should be able to re-direct from any context to any other context...
you will probably lose the session, but you should be able to re-direct...
Try re-directing within the same context... just to see if the re-direct
itself works.
You can also implement a security model (of your own making) that
automatically re-establishes the original session (obviously make it
secure in some fashion). Then when you re-direct from the servlet you
can just assume that the original session is expired... re-direct to an
intermediate form (in all cases) and allow that form to re-direct to the
login page, or to another page that displays the information... etc.
I have also taken this approach when accessing external resources where
I have no control over the timeout of the external resources, or the
user's behaviour, etc).
best of luck
On 07/23/2012 01:10 PM, Szűcs Attila wrote:
I have a screen (lets call it page X) where I do an ajax call that populates a
table, constructed with jqGrid. So here I call localhost/servlet/ajax/Data.json
which is a servlet. Now, if the page expires and the user still wants to access
the table (search data for instance) I would like to redirect the request to
the Login page.
The ajax call calls the Data.json servlet that is not in the same servlet
context as my Login page (which is localhost/servlet/myapp), therefore I cannot
use servlet forward (I am using JBoss 4.2 and I can only forward in the same
servletcontext).
I have tried to redirect with sendRedirect, which is able to call the Login
page that is actually executed but not displayed. And this is where I got lost.
My Login page is executed and I still see page X. I have tried to write the
returned HTML (from Login page) into the response of page X. The HTML page is
actually returned, but not displayed.
How can I redirect from the servlet so that the redirected page is displayed?
Thanks,
Atti
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]