• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirect requests for *.jsp to *.jsf?

Robert D Watkins
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.

    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic