This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

prefix/suffix mapping  RSS feed

 
keith moon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem with prefix and suffix mapping. When I use prefix-mapping
my facelets configuration does not work. I get the error:

javax.servlet.ServletException: Error Parsing /welcomeJSF.jsp: Error Traced[line: 1] The markup in the document preceding the root element must be well-formed.


When I use suffix-mapping
the servlet works but I have a filter problem.

My filter proofes which page is requested by calling the HttpServletRequest method getPathTranslated(). With prefix I get extra path information so I can check if the requested page is the login page:
but with suffix-mapping getPathTranslated always returns NULL.



Could someone please help me, either how to set up facelets with prefix-mapping or when I use suffix-mapping how can I determine within the doFilter method that the login page was requested?

thanks,
Pablo


 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have 2 different problems.

First, it looks like the JSF Facelets page you are attempting to display is not well-formed XML, possibly because there's something wrong with the "<?xml ?>" Processing Instruction that must be the very first item in an XML datastream.

Secondly you have your problem in the filter itself, which I'm not sure about. I can, however, tell you that servlet filters don't behave any different for JSF requests than for non-JSF requests, and that the filter gets invoked before the FacesServlet gets the URL and picks it apart.

You're looking for a JSP page URL. I hope that's what you intended to look for.
 
keith moon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

thanks for your reply. The login page is not well formed as it is a normal jsf page and not a facelets page. With suffix-mapping this is not a problem, the page gets displayed. But when I change to prefix I get the error message. The same happens when I change the welcome-file to forward.jsp. Isn't it possible to mix facelets/normal jsf pages with prefix?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Prefix mapping" and "suffix mapping" are kind of artificial definitions. If you'll notice, the actual element name is "URL Pattern". Meaning that the container will attempt to match all incoming URLs against that pattern, and those that match are routed to the designated target. Or in your case, targets, since you're using the same URL pattern to select for the filter and to route to the FacesServlet. Which is OK if you don't want to filter the non-JSF URLs like image requests and so forth.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!