Win a copy of Pragmatic AI this week in the Artificial Intelligence 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 ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Redirect requests for *.jsp to *.jsf?  RSS feed

Posts: 1
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Long time reader, first time poster (thanks for all the help : )

Is there a way in JSF or, more likely, in JBoss to redirect all requests for a .jsp page to a .jsf request? Can this be done without breaking JSF itself?

Situation :
I have a JSF site running in JBoss that is configured to email me when an exception occurs. However, the most common error seems to be either a confused user or perhaps a bot requesting "/index.jsp" or "/login.jsp" - something with a .jsp extension that is actually a JSF page. If a non-existent page is requested then we 404 and all is well. But, if they request a JSF page that exists such as login.jsp - they'll get a 500 error (handled cleanly) and I'll get an email with the standard : "java.lang.RuntimeException: Cannot find FacesContext" error.

I understand why this exception is being thrown (request to JSF page not going through Faces servlet), but in this case I'd rather catch the request to "login.jsp" somehow and redirect it to "login.jsf" so they get the page they want and I don't get exceptions/error emails. Does that make sense? Basically if someone requests "page.jsp" I want to automatically rewrite the request to "page.jsf"

Environment :
  • JBoss 4.2.2 (I know, it's legacy)
  • JSF 1.2
  • Richfaces 3.3.3 Final

  • To clarify my Faces servlet :

    Let me know if this fits better in the JBoss board... it might.

    Any ideas are welcome.

    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!