Conflict between URL pattern

Splash Forums PrettyFaces Users Conflict between URL pattern

This topic contains 5 replies, has 3 voices, and was last updated by  Christian Kaltepoth 11 years, 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #17800


    Hello everybody. I am from Brazil and I am big fan of PrettyFaces.

    Sorry for my bad english.

    I have two URL-Mapping – for exemple:

    <url-mapping id=”prehome”>

    <pattern value=”/prehome/” />




    <url-mapping id=”setor”>

    <pattern value=”/#{a:someBean}/” />



    Secoud mapping is work fine. If I type it’s work and the value is setting in my Bean.

    But, when I type which is mapped in first exemple, this url directs to secound mapping and try to set “prehome” to Bean property.

    How to do for directs to <pattern value=”/prehome/” />

    <view-id>/faces/pages/prehome.xhtml</view-id> and not to <pattern value=”/#{a:someBean}/” /> ?


    Sorry for my English, I tried and i hope you understands :)



    You could try to add a regular expression to your second mapping that prevents that /prehome/ get matched by the second mapping:

    You could also try to change the order of the two mappings in pretty-config.xml. I had a quick look at the code and it seems like the first mapping matching the URL wins! :-)



    Hi chkal,

    Thank you for reply.

    I solved the problem using regex in my secound mapping like you said.

    I include regex [^prehome]. But it is temporary solution.



    Actually Chkal is correct.

    Using regexes is one of the recommended solutions — using regular expression discriminators is an intended use-case.

    The other is simply to put the more-selective url-mappings first, since they are processed in order from top to bottom in the config, which is also a recommended solution.

    Favor ordering before using regexes.



    Hello again,

    Like i said prehome URL problem was solved using [^prehome] in:

    <pattern value=”/[^prehome]#{a:someBean}/” />

    I had not noticed before. When i try access by:

    It’s get the^prehome]word/

    How to solve this?


    I think your pattern is wrong. It should be something like (I didn’t test it):

    <pattern value="/#{ /(?<=prehome)/ }/" />

    Take a look at the corresponding chapter of the PrettyFaces documentation how to add custom regex patterns to the URL.

    However I would strongly advise you to try playing with the order of the mappings in your pretty-config.xml instead of using such patterns. I think the patterns are evaluated in the order in which they appear in the file. So if you place your prehome pattern in front of all others it should work like expected.

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

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.