Ignore case in prettyfaces pattern

Splash Forums PrettyFaces Users Ignore case in prettyfaces pattern

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

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

    mika
    Participant

    if you defined a url mapping as follows:

    @URLMapping(id = "myPage", pattern = "/myPage", viewId = "/faces/pages/myPage.xhtml")

    if you tried to enter the url as:

    http:localhost:8080/myPage

    this will work fine, but if you changed the case to:

    http:localhost:8080/mypage

    or http:localhost:8080/MYPAGE

    it won’t work, it won’t find the page, so is there’s a way to ignore the case in the pattern, or such thing is not supported in PrettyFaces yet, if not supported, then please suggest a workaround.

    #21769

    Why do you want to ignore case? Wouldn’t you rather have one valid URL, and make sure that all requests are transformed into that?

    <rewrite match="(?i)/mypage" toCase="uppercase" />

    #21770

    mika
    Participant

    i am using annotations, how to apply your solution in my case ?

    #21771

    Use XML for this one rule, or set of rules :) They work together just fine.

    #21772

    mika
    Participant

    @lincoln Baxter III, when i tried to add above rule in my pretty-config.xml, i got the following error:

    cvc-complex-type.2.4.a: Invalid content was found starting with element ‘rewrite’. One of ‘{“http://ocpsoft.com/prettyfaces/

    3.3.0″:url-mapping}’ is expected.

    any ideas why ?

    and what does the (?i) before the page name means ?

    #21773

    Is it an error from your IDE or does it happen at deployment time?

    The (?i) sets the CASE_INSENSITIVE flag for the regular expression.

    http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#CASE_INSENSITIVE

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

You must be logged in to reply to this topic.

Comments are closed.