Continue the chain of filters after forward doesn't work

Hi,
I'm dealing with a problem since two days ago and I guess it's time to ask for some help =).
I'm trying to do a forward and just after that let the filters continue, maybe I have a missunderstanding of the servlet/jsp life cicle, but don't really know.
Let's say I have two filters
A) URLTranslatorFilter. This filter take the URL requested and forward it to the correct URL, so, the user can enter the URL in another language (creepy requirement I know =( ) and being redirected to the actual resource.
http://localhost:8080/test01/entrar.faces
would be translated to
http://localhost:8080/test01/login.faces
B) SessionFilter, it's a simple filter that check for the user being on a session, security control, simple as that.
When a URL It's translated, just after that I have to check the username and all that kind of things, but i get the terrible error:
javax.servlet.ServletException: Cannot forward after response has been committed
the filterChain.doFilter isn't working I think.
In fact, there's more than just a filter after the URLTranslatorFilter, but I can't get it to work even with two of them.
The source for the URLTranslatorFilter:
package mx.www.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
public class URLTranslatorFilter implements Filter {
     public void init(FilterConfig arg0) throws ServletException {
     public void doFilter(ServletRequest request, ServletResponse response,
               FilterChain chain) throws IOException, ServletException {
          System.out.println("URLTranslatorFilter-->");
          if (!(request instanceof HttpServletRequest)) return;
          HttpServletRequest httpServletRequest = (HttpServletRequest) request;
          String currentURI = httpServletRequest.getRequestURI();
          System.out.println("URI-->" + currentURI);
          if (currentURI.equals("/test01/entrar.faces")) {
               RequestDispatcher requestDispatcher = request.getRequestDispatcher("/test01/login.faces");
               requestDispatcher.forward(request, response);
          chain.doFilter(request, response);
          System.out.println("<--URLTranslatorFilter");
     public void destroy() {
}The simple dummy SessionFilter:
package mx.nic.rty.www.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class SessionFilter implements Filter{
     public void init(FilterConfig arg0) throws ServletException {
     public void doFilter(ServletRequest request, ServletResponse response,
               FilterChain chain) throws IOException, ServletException {
          System.out.println("SessionFilter-->");
          chain.doFilter(request, response);
          System.out.println("<--SessionFilter");
     public void destroy() {
}The filters defined in web.xml
     <filter>
          <filter-name>URL Translator Filter</filter-name>
          <filter-class>mx.nic.rty.www.filter.URLTranslatorFilter</filter-class>
     </filter>
     <filter-mapping>
          <filter-name>URL Translator Filter</filter-name>
          <url-pattern>*.faces</url-pattern>
     </filter-mapping>
     <filter>
          <filter-name>Session Filter</filter-name>
          <filter-class>mx.nic.rty.www.filter.SessionFilter</filter-class>
     </filter>
     <filter-mapping>
          <filter-name>Session Filter</filter-name>
          <url-pattern>*.faces</url-pattern>
     </filter-mapping>The sample pages do nothing really just show a simple message, any help you could give me would be appreciated.
I can post more code if necessary =) thanks!
-JF-

Maybe try it like this:
if (currentURI.equals("/test01/entrar.faces")) {
  RequestDispatcher requestDispatcher = request.getRequestDispatcher("/test01/login.faces");
  requestDispatcher.forward(request, response);
else{
  chain.doFilter(request, response);
}Forwarding control to a request dispatcher is sending a response
calling chain.doFilter() is also sending a response.
You can only send one response per request, so if you forward control to another resource, you should stop the current resource sending a response.

Similar Messages

  • After the last update Acrobat X Pro doesn't work anymore. It doesn't open

    after the last update Acrobat X Pro doesn't work anymore. It doesn't open

    Prakash,
    Since I couldn't get a hold of someone at Adobe today, Sunday, would you please let me know about the following:
    1)  My laptop has "blue screen of death".  What can Adobe do for me if I restored my system back to when I first bought it from the store and potentially lose my Adobe X?
    2) I bought my Adobe X on Jan. 10, 2010 thru Barnes & Noble Campus E store thru JourneyEd. 
    Rosemarie

  • The zoom in zoom out gesture doesn't work on my iPhone 5c. Like when opening an app it doesn't zoom out and opens.

    The zoom in zoom out gesture doesn't work on my iPhone 5c. Like when opening an app it doesn't zoom out and opens. It also doesn't zooms in while pressing the home button to return. The gesture is just like any other Android phone. Like while closing an app by pressing the home button the icons seem like zooming in and falling back to their respective places. This thing happens in my friends' iPhones but this thing doesn't happen on my iPhone 5C. Please help.. I am unable to find anything wrong with the settings either.
    Message was edited by: Prats20

    I have another query though. Is it possible to always logged into my Gtalk from iPhone? I am using an app called Gtalk Lite. But every time I double press the home button and swipe up the apps to close them from running in the background Gtalk lite logs me off. I have to log in to Gtalk lite again. I was looking for something like that happens on Android phones. You are always logged in even after you close them from running in the background. And also is it possible to log in to more than one gmail account on Gtalk in iPhone?

  • HT4061 I have an iphone 3gs - the new ios 6.1 (?) upgrade has inabled my phone. I get a white apple on the screen. can't reset phone - doesn't work. what can I do besides take phone into Apple?

    I have an iphone 3gs - yes, an older iphone. 
    This morning apple had a msg that asked if I wanted to upgrade to the new ios 6.1 (?).  I said yes.  Now I can't use my phone.  I've tried hitting the power and other buttons.  I get a white apple on the screen. can't reset phone - doesn't work. what can I do besides take phone into Apple?  This *****!  I realize (now from reading internet) that my phone/system may be uncompatible.  Help!

    I have a 3GS (a true classic design!) and have upgraded it to 6.1 today.  The process did not go without a glitch - it took a few attempts to get the app's to sync but after detecting the ones causing an issue and deleting them it works - so far!  I have had issues about 50% of the numerous times a new OS is uploaded to this phone and always take the new OS with trepidation.  But at least you know there is a 3GS with 6.1 working OK.
    I suggest you do a fresh restart to the phone several times - without it being connected to the computer - to see if it gets its act together and starts.  I think it will.  Hold down the top 'power' button and front round control button until it shuts down - goes blank and dead.  Then press the top power button to re-activate - reboot - it.
    If that does not work then plug into your itunes computer, navigate in iTunes to see your iPhone and hopefully you will be able to sync it or at least 'restore iPhone' from the 'summary' tab.
    If you can not get onto the iphone perhaps you will still be able to sync if in iTunes by going - 'file' - 'devices' - 'sync iphone' or failing that try transfer purchases' and ultimately 'restore from back-up'.
    I had technical problems with my old 3GS (suffered a failed wireless antenna) so I took it to an Apple Store and they issued me with a service-replacement/reconditioned phone for a very modest charge.  So if worst come to the worst get a new phone that way!

  • Moving backward and forward doesn't work as it used to do

    The latest update, 32.0.2, or perhaps the one earlier, 32.0.1, has created a problem with Fx.
    Moving backward and forward doesn't work as it used to do; and if it is done quickly, backward and then forward again to the last page, Fx gets confused and both pages get the same address and the browser shows the same page.
    Guess it has something to do with the latest changes to how Fx handles the cache, or that in combination with how some pages use scripts.
    As it is it can be a pain to use sometimes.

    Are you able to switch songs from control center when Spotify is playing on your phone?
    If you have Spotify playing on your computer then it won't show in control center on your phone. You will have to open up the app to control music on your computer. 
    This is because iOS does not show anything on the control center unless an app is outputing audio. The Spotify app is not outputing audio, it only shows what is playing on your computer.
    Does that make sense?

  • I have iphone 3gs and im update my iphone to ios 6 and after it doesn't work,and i can't restore my iphone please help meeeeeeeee,i neeed my iphone:(

    i have iphone 3gs and im update my iphone to ios 6 and after it doesn't work,and i can't restore my iphone please help meeeeeeeee,i neeed my iphone:(

    how can i restore my iphone without update?because when i want restore itunes told me restore and update and when i restore and update my iphone take the ios 6 and it doesn't work again...please help mee...tnnnxxx

  • I just downloaded the updates and now my mail doesn't work. It says I now need a newer version of OS to allow I've to open my mail which I can't right now

    I just downloaded the updates and now my mail doesn't work. It says I now need a newer version of OS to allow I've to open my mail which I can't right now

    What version of the OS X are you running? Go to the Apple in the upper left corner and select About This Mac and report the Version back here.

  • I have an iPod Classic and the latest version of iTunes. I make all my purchases on my computer, but when I try to click the "add to" option and transfer the songs to my iPod, it doesn't work. How can I get my songs from my computer to my iPod?

    I have an iPod Classic and the latest version of iTunes. I make all my purchases on my computer, but when I try to click the "add to" option and transfer the songs to my iPod, it doesn't work. How can I get my songs from my computer to my iPod?

    See this excellent user tip from another forum member turingtest2 outlining the different methods and software available to help you copy content from your iPod back to your PC and into iTunes.
    Recovering your iTunes library from your iPod or iOS device
    B-rock

  • The Bluetooth on my 2012 Lexus doesn't work with my iPhone 5.  My old android phone worked perfectly with my car.  Even the tech guy at Lexus couldn't get it to work.  What is apple doing to fix this.

    The Bluetooth on my 2012 Lexus doesn't work with my iPhone 5.  My old android worked perfectly with my car.  Even the tech specialist at Lexus couldn't get it to work.  Lexus said that other iPhone 5s were having the same problem.  What is apple doing to fix this?

    Going to the local Apple store this morning...
    My problem is not uncommon as the board is showing signs of this happening to many others as well. That is where I found the restore and reboot information to try to solve the issue of crashing apps.
    I understand that Apple will not "give away the cow", but letting iPhone users know that the problems they are having are being addressed by Apple is a little more comforting than nothing at all. Other wise, all the apps in world are useless and even more importantly worthless, if a person has to reset/reboot/reload just to get them to work.
    IF Apple can not address the basic problems with todays iPhone apps, why should one believe that the iPhone 3.0 OS is any better? Using a PC comparison, which is better, XP or Vista. If the current iPhone OS of 2.2. what ever is not working that well (as related to down loaded apps and iTunes), will OS 3.0 be any better?
    The waste of time I refer to is in going to the apps store and downloading the apps... Again why by apps if the free version does not work?

  • Upgraded to os7 and done my updates on the apps as they appear.. Any function to do with the iBook store is not working or visible.  The purchase at the end of a sample book doesn't work either.

    Upgraded to os7 and done my updates on the apps as they appear.. Any function to do with the iBook store is not working or visible.  The purchase at the end of a sample book doesn't work either. Anyone have a solution?

    Upgraded to os7 and done my updates on the apps as they appear.. Any function to do with the iBook store is not working or visible.  The purchase at the end of a sample book doesn't work either. Anyone have a solution?

  • I have made many purchase on app but when i want to made an in-app purchase of a game, it appears "your purchase could not be completed". i have disabled the restriction already but it still doesn't work. anyone can give a hint or a hand here?  cheers~~~

    i have made many purchase on app but when i want to made an in-app purchase of a game, it appears "your purchase could not be completed". i have disabled the restriction already but it still doesn't work. anyone can give a hint or a hand here?  cheers~~~

    http://www.apple.com/support/itunes/contact/

  • Before I upgraded my iPad mini, you could turn off apps to save battery power by double clicking the control button and then holding your finger on the app button until the minus sign appeared.  That doesn't work anymore.  How do you turn off the apps wit

    Before I upgraded my iPad mini, you could turn off apps to save battery power by double clicking the control button and then holding your finger on the app button until the minus sign appeared.  That doesn't work anymore.  How do you turn off the apps with ios7

    Now you swipe downward, the app will appear and you delete, keep scolling to the right as in the past.  With the new operating system you also swipe downward to get the search bar to find an app

  • The speakers on my iphone 4s doesn't work to ring or to play music how do I fixes it?

    The speakers on my iphone 4s doesn't work to ring or to play music how do I fixes it?

    Try resetting your phone by pressing and holding both your home and power button at the same time for about 15-20 seconds till the apple logo appears ..
    Hope it works out for u :)

  • TS1398 The internet on my Iphone 4 doesn't work when I use the Wifi

    The internet on my Iphone 4 doesn't work when I use the Wifi at home. My Mac works fine. On the Iphone it shows it's connected but it doesn't open any app. Anyone knows what to do? Thanks

    Ÿ. If you tap and hold the "Y" does it appear? If so, just slide your finger up to select.

  • How can i stop the i tune pop force quit doesn't work

    hi ,
    please help " how can i stop the i tune pop force quit doesn't work"

    Refunds on downloaded software are virtually nonexistent.
    I have had cases where I purchase software on a physical disk. If I don't like the software I can uninstall it from my computer and sell it legally. Recouping most of my loss.

Maybe you are looking for

  • How do I restore photos to a reformatted iphone?

    My 5s has been really buggy lately, apps crash and freeze all the time. Thinking I should reformat and restore to factory settings, but after I do that, how do I restore my photo library to it?

  • PSE7 Restore to different PC fails to update drive letter in catalog

    I'm trying to simply copy my catalog and photos from my desktop to my laptop to have with me when I'm away. From all the discussions it seemed like backup/restore was the best method in order to preserve all the tags and other data associated with th

  • In search of a calendar

    Hey there, many month ago I switched from a Mac a year ago, and now I'm missing a good calendar (like iCal). Is there any known good one? Maya-calendar from eOS is the most similar I found, but not stable on my systems. Last edited by sonnenschein (2

  • HT201210 I have problem in my phone 5s

    Hi can you help me please I have Iphone 5s but from tow days not working i trayed many times restore but still problem please could you help me ? Best Regards ..

  • Ejb-client.jar

    Hi, I've got an EJB system that until now have been packaging as just a bean jar and not bothering with a ejb-client.jar. I now want to package as follows a). A bean EAR file (containing bean jar, and dependency jars) - for deploying on EJB server. b