jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: Exact mapping [Spec PDF]

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Fri, 13 Jan 2017 00:58:52 +0100

Hi,

Here's the text to be added to the spec PDF, 7.6.2.1 to the end of the
section for the deriveViewId requirements:

"If an exact mapping (such as “/foo”) is used for FacesServlet, the viewId
is set using following algorithm.

Let requestViewId be the value of argument input.

Obtain the value of the context initialization parameter named by the
symbolic constant ViewHandler.FACELETS_SUFFIX_PARAM_NAME. (if no such
context initialization parameter is present, use the value of the symbolic
constant ViewHandler.DEFAULT_FACELETS_SUFFIX). Let this be
faceletsDefaultSuffix.

Obtain the value of the context initialization parameter named by the
symbolic constant ViewHandler.DEFAULT_SUFFIX_PARAM_NAME (if no such context
initialization parameter is present, use the value of the symbolic constant
ViewHandler.DEFAULT_SUFFIX). Let this be defaultSuffixes.

Add faceletsDefaultSuffix to defaultSuffixes.

For each entry in the list from defaultSuffixes, add that current entry to
the end of requestViewId. For discussion, call this candidateViewId. Look
for a physical resource with the name candidateViewId. If such a resource
exists, consider the algorithm complete with the result being
candidateViewId.

Otherwise, if a physical resource exists with the name requestViewId let
that value be viewId. Otherwise return null."

Kind regards,
Arjan Tijms







On Thu, Jan 12, 2017 at 11:33 PM, arjan tijms <arjan.tijms_at_gmail.com> wrote:

> Hi,
>
> For issue 1260 I've added basic awareness for the so-called "exact
> mapping", meaning when the FacesServlet has as url pattern for a servlet
> mapping like "/foo".
>
> The most important JavaDoc for it is in this commit (in our private repo
> which is already pushed to the java.net repo as well):
>
> https://github.com/jsf-spec/mojarra/commit/fd56d980b9df4d8d8f579c51062046
> 6fc2062426
>
> See Resource#getRequestPath
>
> * <div class="changed_added_2_3">
> * <p>If exact mapped, <em>result</em> must be the following if and
> only
> * if the FacesServlet is mapped to the exact URL pattern {_at_link
> * ResourceHandler#RESOURCE_IDENTIFIER} + {_at_link #getResourceName}
> * </p>
> *
> * <blockquote>
> * <p><code>result = <em>contextRoot</em> + {_at_link
> * ResourceHandler#RESOURCE_IDENTIFIER} + {_at_link
> #getResourceName}</code></p>
> * </blockquote>
> *
> * <p>If exact mapped, and the FacesServlet is <em>not</em> mapped to
> the exact
> * URL pattern {_at_link ResourceHandler#RESOURCE_IDENTIFIER} + {_at_link
> #getResourceName}
> * do the following:
> * </p>
> *
> * <p>
> * Retrieve the existing mappings of the FacesServlet, e.g. using
> * {_at_link ServletRegistration#getMappings()}, and from those pick any
> * prefix mapping or extension mapping. If no such mapping is found,
> * throw an {_at_link IllegalStateException}. If such mapping is found
> remove
> * the <code>*</code> character from that mapping, take that as the
> new
> * <em>facesServletMapping</em> and continue with evaluating this
> mapping
> * as specified below for <em>if prefix mapped</em> and for
> * <em>if extension mapped</em>
> * </div>
>
> The JavaDoc for the ViewHandler doesn't spell out the requirements in the
> JavaDoc, but points to JSF.7.6.2, so I'll send the text for that
> momentarily.
>
> Kind regards,
> Arjan Tijms
>
>