Thanks Adam, Indeed I was calling  filterChain.doFilter(request,
response) after redirect.

I just tried commenting filterChain.doFilter. No IllegalStateException
comes now and am redirected to third party url.

But now my application is not working if authorization is successful; I
am getting a blank page! No exception and no logs as well....

Any idea on how to proceed?

Here is my doFilter method:
public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain filterChain) throws IOException, ServletException {
        try {
            //check authentication
                // If not authorized, redirect to the third party
application
        } catch (InvalidUserException ine) {
            logger.error("Invalid User Exception from TPY ", ine);
        } catch (TPYException tpe) {
            logger.error("TPY Exception ", tpe);
        } catch (Exception ex) {
            logger.error("General Excepion in doFilter ", ex);
        }

        // filterChain.doFilter(request, response);
  }


I am not using any other filters.

I have the following mappings in the web.xml:

<!-- Filter Mapping -->
 <filter-mapping>
              <filter-name>AuthenticationFilter</filter-name>
              <url-pattern>*.do</url-pattern>
      </filter-mapping>

<!-- Standard Action Servlet Mapping -->
      <servlet-mapping>
      <servlet-name>action</servlet-name>
                <url-pattern>*.do</url-pattern>
      </servlet-mapping>



Regards,
Bharat
-----Original Message-----
From: Samere, Adam J [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 16, 2006 6:45 PM
To: Struts Users Mailing List
Subject: RE: How to avoid IllegalStateException ?

You aren't calling FilterChain.doFilter(req,res) after sending the
redirect are you? Are there any other filters ahead of this filter in
the pipeline that use the response? Perhaps you could post the
applicable code from your Filter and information regarding any other
filters you are using.

-Adam

-----Original Message-----
From: Bharat Kumar Meda [mailto:[EMAIL PROTECTED]
Sent: Friday, June 16, 2006 8:55 AM
To: Struts Users Mailing List
Subject: How to avoid IllegalStateException ?


Hi,

I have a struts based application and using Filters for authorization.
If the user is not authorized, I have to redirect the user to a third
party application.

For that, in the doFilter method, I have added the redirection logic (I
am using response.sendRedirect to take the user to the third party
application.)

Now, the issue is that whenever I call my app url I get the following
exception though I am redirected to the third party application. Is
there a way to avoid this exception?
"java.lang.IllegalStateException: Cannot forward a response that is
already committed"

Is there a way to avoid this exception?

My web.xml has the following entry:
<filter-mapping>
     <filter-name>AuthenticationFilter</filter-name>
     <url-pattern>*.do</url-pattern>
</filter-mapping>

Thanks in advance,
Bharat

**************** CAUTION - Disclaimer ***************** This e-mail
contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the
use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further,
you are not to copy, disclose, or distribute this e-mail or its contents
to any other person and any such actions are unlawful. This e-mail may
contain viruses. Infosys has taken every reasonable precaution to
minimize this risk, but is not liable for any damage you may sustain as
a result of any virus in this e-mail. You should carry out your own
virus checks before opening the e-mail or attachment. Infosys reserves
the right to monitor and review the content of all messages sent to or
from this e-mail address. Messages sent to or from this e-mail address
may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-----------------------------------------
The information contained in this message may be privileged,
confidential, and protected from disclosure. If the reader of this
message is not the intended recipient, or any employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution, or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.

Thank you. Paychex, Inc.


---------------------------------------------------------------------
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]

Reply via email to