You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Mike Kienenberger <mk...@gmail.com> on 2005/12/21 18:14:33 UTC

Proposal: change suggested MyFaces extension mapping examples and docs

Currently extensionsFilter.xml suggests the following configuration information:

<filter-mapping>
	<filter-name>MyFacesExtensionsFilter</filter-name>
	<url-pattern>*.jsf</url-pattern>
</filter-mapping>

<filter-mapping>
	<filter-name>MyFacesExtensionsFilter</filter-name>
	<url-pattern>/faces/*</url-pattern>
</filter-mapping>

I'd like to propose that we change it to the following two mappings instead:

 <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
  </filter-mapping>

The above mapping will work with any FacesServlet mapping, provided
they've named it "Faces Servlet"  (I'll add a note pointing out the
importance of matching the name in the docs).

  <filter-mapping>
      <filter-name>MyFacesExtensionsFilter</filter-name>
      <url-pattern>/faces/myFacesExtensionResource*</ url-pattern>
  </filter-mapping>

The above mapping will eliminate the confusion that users only need to
set the mapping to be whatever they've mapped their Faces Servlet to. 
The full path is already specified in AddResource, so there's no
reason not to put it into the mapping as well.  My only question on
this one is if the mapping should have a trailing slash or not.  I'm
guessing it shouldn't, but I'm no mapping expert.

/faces/myFacesExtensionResource*
 or
/faces/myFacesExtensionResource/*

    private static final String RESOURCE_VIRTUAL_PATH =
"/faces/myFacesExtensionResource";

Anything I'm overlooking?

Re: Proposal: change suggested MyFaces extension mapping examples and docs

Posted by Mike Kienenberger <mk...@gmail.com>.
Here's my draft of suggested changes.

 <!-- extension mapping for adding <script/>, <link/>, and other
resource tags to JSF-pages  -->
 <filter-mapping>
     <filter-name>MyFacesExtensionsFilter</filter-name>
     <!-- servlet-name must match the name of your
javax.faces.webapp.FacesServlet entry -->
     <servlet-name>Faces Servlet</servlet-name>
 </filter-mapping>

 <!-- extension mapping for serving page-independent resources
(javascript, stylesheets, images, etc.)  -->
 <filter-mapping>
     <filter-name>MyFacesExtensionsFilter</filter-name>
     <url-pattern>/faces/*</ url-pattern>
 </filter-mapping>


The pattern "/faces/myFacesExtensionResource*" is not legal.
The pattern "/faces/myFacesExtensionResource/*" doesn't appear to
work, and I'm not sure why that is.

On 12/21/05, Mike Kienenberger <mk...@gmail.com> wrote:
> Currently extensionsFilter.xml suggests the following configuration information:
>
> <filter-mapping>
>         <filter-name>MyFacesExtensionsFilter</filter-name>
>         <url-pattern>*.jsf</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
>         <filter-name>MyFacesExtensionsFilter</filter-name>
>         <url-pattern>/faces/*</url-pattern>
> </filter-mapping>
>
> I'd like to propose that we change it to the following two mappings instead:
>
>  <filter-mapping>
>       <filter-name>MyFacesExtensionsFilter</filter-name>
>       <servlet-name>Faces Servlet</servlet-name>
>   </filter-mapping>
>
> The above mapping will work with any FacesServlet mapping, provided
> they've named it "Faces Servlet"  (I'll add a note pointing out the
> importance of matching the name in the docs).
>
>   <filter-mapping>
>       <filter-name>MyFacesExtensionsFilter</filter-name>
>       <url-pattern>/faces/myFacesExtensionResource*</ url-pattern>
>   </filter-mapping>
>
> The above mapping will eliminate the confusion that users only need to
> set the mapping to be whatever they've mapped their Faces Servlet to.
> The full path is already specified in AddResource, so there's no
> reason not to put it into the mapping as well.  My only question on
> this one is if the mapping should have a trailing slash or not.  I'm
> guessing it shouldn't, but I'm no mapping expert.
>
> /faces/myFacesExtensionResource*
>  or
> /faces/myFacesExtensionResource/*
>
>     private static final String RESOURCE_VIRTUAL_PATH =
> "/faces/myFacesExtensionResource";
>
> Anything I'm overlooking?
>