I want to prevent direct access to *.xhtml files in my project. In pages, there are commandLinks which calls some methods of some beans. Those beans return the name of view as string.
return "campaign.xhtml?faces-redirect=true";
If user writes to the address bar of browser the following, I don't want the user to see the xhtml file.
http://localhost:8080/myApp/faces/campaign.xhtml
or
http://localhost:8080/myApp/faces/campaign.xhtml?faces-redirect=true
Because, in some beans, I fill these xhtml views. However, if user directly accesses to the xhtml file, user sees these views without the filled information.
When I use in web.xml file, access is denied. However, in this case, when the bean returns the value "campaign.xhtml?faces-redirect=true", it can not also show the view too. The access is denied for the bean too.
What can I do to prevent this?
Thanks.
Faruk Kuşcan