The response is considered committed once you have written to the
outputstream (perhaps in a jsp).
Once a response has been comitted, you can not redirect or forward etc.
The best solution is to redirect before you write anything to the output
stream, sometimes this is not possible.
Another slightly dodgy solution (I have used this) is to write a script
tag to the outputstream.
<script>
document.location.href = 'loginPage.do';
</script>
You can check if the response has been comitted using response.isComitted()
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletResponse.html
Gajbhe, Laxman (Contractor) wrote:
Hi,
I've following global result to handle authentication.
<global-results>
<result name="login" type="chain">
<param name="actionName">login</param>
<param name="namespace">/home</param>
<param name="method">input</param>
</result>
...
</global-results>
For most part this works fine. The only problem with this is that on
session timeout, it opens up the login page nested inside the page being
requested.
For example if there are tabs on the page and if the user clicks on one
of the tab when the session is timed out, it opens the login page as a
content of the current tab.
So, I figured changing result type to 'redirect-action' should fix it.
Now it started complaing about "response already commited" when I am
logging in first time itself.
Here is the snippets of my interceptor code:
public String intercept(final ActionInvocation invocation) throws
Exception {
final SessionMap session = (SessionMap)
ActionContext.getContext().get(ActionContext.SESSION);
final SessionSecureUser user = (SessionSecureUser)
session.get(Constants.AUTHORIZED_KEY);
if (user == null) {
return Action.LOGIN;
}
Could you please suggest where I could be going wrong with this?
thanks for your help!
Laxman
This e-mail and its attachments are confidential and solely for the
intended addressee(s). Do not share or use them without Fannie Mae's
approval. If received in error, contact the sender and delete them.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]