Win a copy of Mastering Non-Functional Requirements this week in the Design forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF lifecycle is not getting called after Servlet Filter Forward or Redirect  RSS feed

 
Siddarth Cherukumudi
Greenhorn
Posts: 29
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a scenario here where the JSF lifecycle is not getting invoked. I have a filter, whose responsibility is to filter only authorized requests

the code of the filter is given below



now in the else block i am filtering the unauthorized requests, and sending them back to the Login.xhtml page of the application.

The problem i am encountering here is that, the images and styles associated with the page are not getting loaded, what i am thinking is that when i am using redirect or forward, the FacesServlet is not getting called, and it is directly going to Login page i.e. no Lifecyle is being called.

Am I right on this?, if so how to Filter the requests and at same time not lose the styles?


please help me
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Siddarth Cherukumudi wrote:
The problem i am encountering here is that, the images and styles associated with the page are not getting loaded .....

what i am thinking is that when i am using redirect or forward, the FacesServlet is not getting called, and it is directly going to Login page i.e. no Lifecyle is being called.

Am I right on this?, if so how to Filter the requests and at same time not lose the styles?


please help me

Use firebug or some other client side debugging tool to see why the style sheets are not being loaded. Maybe you are restricting access to them as well until someone is logged on?
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your web.xml look like? Take a look at the web.xml's xsd file. It has an element called "dispatcher" and is used under the filter-mapping element. You have to set the relevant value(s) using the <dispatcher> element(s) to get this working for "forward". Here's what the documentation of that element says:

 
Siddarth Cherukumudi
Greenhorn
Posts: 29
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot guys for the quick responses

Use firebug or some other client side debugging tool to see why the style sheets are not being loaded. Maybe you are restricting access to them as well until someone is logged on?


I have already debugged with firebug, what i am seeing in the url is: IncidentReportingPortal/javax.faces.resource?jsessionid=4DFGFFDD232232/cyient.jpg.xhtml?ln=images

and it is clearly showing that no such resource exists, but the scenario is different when i remove the filter, everything is working perfectly


What does your web.xml look like? Take a look at the web.xml's xsd file. It has an element called "dispatcher" and is used under the filter-mapping element. You have to set the relevant value(s) using the <dispatcher> element(s) to get this working for "forward". Here's what the documentation of that element says:



I did not add the dispatcher to the filter tag in web.xml, assuming the default would be forward, is this where the problem is?
please enlighten me

 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Siddarth Cherukumudi wrote:

I did not add the dispatcher to the filter tag in web.xml, assuming the default would be forward, is this where the problem is?
please enlighten me



Please read the documentation I posted earlier. It already tells what the default is and what needs to be set to get it working.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!