Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Faces servlet exception with forwarding  RSS feed

 
henri delbrouck
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With MyFaces 1.0.9 and Tomcat 5.0.28, I have activated a filter.

Within this filter, I call a method which check if the user has already been authenticated. If he is not authenticated, there is a forward to an external system for authentication (CAS system).

Withe the faces servlet, I receive the following error:
"cannot not forward after response has already been committed".

This does not happen with normal JSP pages. The forwarding occurs successfully.

Could anybody help me what is wrong and what is the solution to avoid this problem.

Thank you in advance

Henri-Philippe Delbrouck
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does the code in your filter look like?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually, you'll get this message when you have tried to forward the request somewhere more than once in a servlet. So if you had something like:



What you will want to do is set whatever parameters you need in the if/else and then foward only once.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!