Inherit from a parent URL-mapping Documentation

Splash Forums PrettyFaces Users Inherit from a parent URL-mapping Documentation

This topic contains 4 replies, has 3 voices, and was last updated by  Lincoln Baxter III 5 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #18098

    Paul
    Participant

    Hi,

    Currently trying to add PrettyFaces 3.3.2 to my projects so today was an intense reading of the full documentation. Everything was fine until I read about inheritance mapping http://ocpsoft.com/docs/prettyfaces/3.3.2/en-US/html/Configuration.html#config.mapping.parents

    I’ve made a few tests, and maybe I’m wrong, but seems to me that for a child, the final pattern will be the strict concatenation of all the parent’s patterns, adding itself finally. So, in the documentation example, if you have :

    <url-mapping id="store">

    <pattern value="/store/" />

    <~-- Result: /store/ -->

    <view-id value="/faces/shop/store.jsf" />

    </url-mapping>

    <url-mapping parentId="store" id="category">

    <pattern value="/#{category}" />

    <~-- Result: /store/#{category} -->

    <view-id value="/faces/shop/category.jsf" />

    </url-mapping>

    The result is not “/store/#{category}” but “/store//#{category}” because both the final slash of the parent and the first slash of the child are concat. At least, it is what happens in my project. I can paste the full code of my pretty-config.xml and the url mapped if necessary.

    Regards.

    #21709

    That sounds right. So I would not start the child mapping with a ‘/’ in this case.

    Does that work?

    #21710

    Paul
    Participant

    Yes, that’s what I’ve done on my project : no child pattern starts with a “/” since it is already provided by the parent.

    #21711

    @lincoln: I guess we should change the example in the documentation as it is not entirely correct. If we remove the trailing slash from the first mapping everything would be correct.

    #21712

    @chkal, yes, let’s do that.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Comments are closed.