-1

I want to use a custom URL extension for my facelets. Like, let's say, .asdf instead of .xhtml or .jsf.

I added the mapping to my web.xml:

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.asdf</url-pattern>
</servlet-mapping>

The index.asdf is located in WebContent/facelets/common/index.asdf but if I try to access it with the browser (http://localhost:8080/Project/facelets/common/index.asdf)I get the following error message:

HTTP Status 404 - /Project/facelets/common/index.jsp

type Status report

message /Project/facelets/common/index.jsp

description The requested resource is not available.

Apache Tomcat/7.0.39

Note that it says .jsp even though I haven't used the .jsp extension anywhere. Any pointers what's wrong there?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
mediocre
  • 564
  • 1
  • 7
  • 24

1 Answers1

0

Ok, it looks like I misunderstood some of the basics here. I renamed my files on disk to index.asdf, which I shouldn't have. They should keep the .xhtml extension and only the extension I access them with is the new one. Now everything works as expected. If you want to restrict access to these raw .xhtml files use this https://stackoverflow.com/a/5675913/989919

Community
  • 1
  • 1
mediocre
  • 564
  • 1
  • 7
  • 24