Doubt abut 'pattern' in @URLMapping

Splash Forums PrettyFaces Users Doubt abut 'pattern' in @URLMapping

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #19567

    albertoivo
    Participant

    Hello everyone,

    I’m facing a little problem and I couldn’t resolve it alone reading the tutorial. When I do this:

    @URLMapping(id = "student", pattern = "/student", viewId = "/person/student/principal.xhtml") // without final slash in pattern

    and run the URL: http://localhost:8080/project/student (without slash at the end)

    It’s perfect

    But if I run the url like this: http://localhost:8080/project/student/ (with slash at the end) I get HTTP 404.

    I’ve tried to use Expression Languages pattern = "/student#{[^/]+}" but nothing works.

    How could I fix this?

    Thanks in advance.

    #23458

    albertoivo
    Participant

    I got it using:

    <rewrite trailingSlash="remove" />

    But I didn’t understand if I should use redirect=301 or 302

    I mean, I know that 301 is Permanent and 302 is Temporary… But what does this really mean?

    #23459

    For PrettyFaces /student and /student/ are completely different URLs. If you want both to work, you should rewrite them like you showed in your second post. The difference between a permanent and a temporary redirect is, that a permanent can be cached by a browser, the temporary not.

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

You must be logged in to reply to this topic.

Comments are closed.