• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Filter Issue

 
Naveen puttu
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Below is a servlet filter code



I get IllegalStateException if try to redirect or use RequestDispatcher . It says "Cannot forward after response is committed"

Please help

Cheers
Naveen
 
Malatesh Karabisti
Ranch Hand
Posts: 153
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please post head of the error stack trace ?
 
Naveen puttu
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the stack trace



By the way the control goes in this flow only at the moment



To add to the misery . The filter works perfectly fine once the server is restarted , but then throws this exception after a while (lets say when session times out )

I dont know whatz happening

Cheers
Naveen
 
Malatesh Karabisti
Ranch Hand
Posts: 153
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


have you tried by commenting the "return" in the block just try this
 
Naveen puttu
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did that , still NO GO
 
parampreet sethi
Greenhorn
Posts: 27
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try putting return after each forward and response.sendredirect method calls.

The forward and sendredirect method calls does not mean that the rest of the code will be ignored. Yesterday I was having the same issue and putting return after each sendRedirect and forward fixed this issue.

Hope it helps.
 
Naveen puttu
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
parampreet sethi wrote:You can try putting return after each forward and response.sendredirect method calls.

The forward and sendredirect method calls does not mean that the rest of the code will be ignored. Yesterday I was having the same issue and putting return after each sendRedirect and forward fixed this issue.

Hope it helps.


I tried that , as explained earlier . It works fine until the session times out . After that we are back to square one
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic