Limit access to *.jsf files

Splash Forums PrettyFaces Users Limit access to *.jsf files

This topic contains 3 replies, has 4 voices, and was last updated by  RedShadow 10 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #17946


    I’m new to JSF and pretty faces so my question can be simple. So in my project I have following mapping @URLMapping(id = “index”, pattern = “/index”, viewId = “/index.jsf”) it work great but now I what to prohibit access to index.jsf directly.

    So now and both work but I want to disable second one.

    Thanks ..



    I have some people looking into the best answer for you here. Will hopefully have something soon. It’s a good question and of course you can always just create your own Filter that denies access to these URLs (which is what I usually do,) but I think there’s a more elegant solution.



    I don’t think this is possible without writing a custom filter. One thing you could try is to create a rewrite rule to redirect the user to /index if /index.jsf is accessed. Something like:

    <rewrite match="/(.*).jsf" substitute="/$1" redirect="301"/>

    I didn’t test this, but you could try it. :)



    I already had such a problem and i did it like that:

    <rewrite match=”^/admin/((?!pageNotFound).)*.xhtml$” substitute=”/admin/pageNotFound.xhtml”/>

    this will restrict access to all xhtml files except the pageNotFound.xhtml. if a request goes to a xhtml file, the request will be redirected to the pageNotFound.xhtml

    Chaining does not work, but i still don’t know why.

    This is tested for my case and should work.

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

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

Comments are closed.