I have a security constraint in my web.xml, so all pages inside "restrict" folder, are protected and the user can't enter them manually.
web.xml
<security-constraint>
<display-name>restrict</display-name>
<web-resource-collection>
<web-resource-name>Restric Access</web-resource-name>
<url-pattern>/restrict/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>PUT</http-method>
<http-method>HEAD</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint />
</security-constraint>
In one of these pages, I'd like to pass parameters to the other page using the navigation rule below.
faces-config.xml
<navigation-rule>
<from-view-id>/restrict/ranking.xhtml</from-view-id>
<navigation-case>
<from-outcome>editPerson</from-outcome>
<to-view-id>/restrict/person.xhtml</to-view-id>
<redirect include-view-params="true">
<view-param>
<name>idPerson</name>
<value>#{ranking.person.idPerson}</value>
</view-param>
</redirect>
</navigation-case>
</navigation-rule>
But it's not possible because I restricted the GET method, and I'm getting "Access to the requested resource has been denied"
.
So, what is the correct way to pass the parameter to the other page?
Using a @SessionScoped @ManagedBean to set a session variable, and reseting it as soon as I use in the other page?
Using FacesContext.getCurrentInstance().getExternalContext().getSessionMap() to add and remove attributes as soon as I use them?
Or what?
I'm worried about the first 2 suggestions, because the user may open a lot of tabs in his browser to use my app, so there will be only one value for all tabs.
EDIT: About the error I'm getting, there's no stacktrace in the console the page that I'm redirected to is like this:
HTTP Status 403 - Access to the requested resource has been denied
type Status report
message Access to the requested resource has been denied
description Access to the specified resource has been forbidden.
Apache Tomcat/7.0.47
To solve this error, I could simply remove the <http-method>GET</http-method>
in my security constraint, but then I would be able to enter the page manually.