Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

JSF Suggestions Needed

 
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am developing a JSF application where by the navigation is from PageA-->PageB-->PageC . At page A The user signs in. The problem is if a user decides to access Page B with out signing in I want the application to authomatically redirect to PageA so that this user can sign in .
Any Suggestions would be welcome
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A filter should do the trick.
Google "Intercepting Filter Pattern"
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you not just use standard servlet security for this?

[ August 26, 2007: Message edited by: James McCluskey ]
 
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Check for a specific token in the session, if that token is not there, do the redirection, otherwise, do your normal work.

Get a reference to the current instance of the FacesContext, which you use to get an instance of the ExternalContext, which has a method named getSession() that references to the HttpSession object.

Let me know what happens with you ...

Best of luck ...
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And one more thing, the ExternalContext contains a method named getResponse(), which actually is the HttpServletResponse, so you can use its sendRedirect() method to do the redirection.

Whenever the user logs in, use the HttpSession object to add an attribute in the session.

Best of luck ...
 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vassili Vladimir:
Hi,

Check for a specific token in the session, if that token is not there, do the redirection, otherwise, do your normal work.

Get a reference to the current instance of the FacesContext, which you use to get an instance of the ExternalContext, which has a method named getSession() that references to the HttpSession object.

Let me know what happens with you ...

Best of luck ...



The idea Sounds interesting,I would try this and let you know

Thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic