• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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

 
Ranch Hand
Posts: 37
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 37
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
and POOF! You're gone! But look, this tiny ad is still here:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic