[
http://jira.jboss.com/jira/browse/JBSEAM-1083?page=all ]
Felix Ho?feld reopened JBSEAM-1083:
-----------------------------------
I am sorry, I have to reopen this. I do not have put together a complete test-case but I
have found the source of the issue.
I have a session bean like this:
@Stateful
@Name("action")
@Restrict("#{identity.loggedIn}")
public class action {
private String parameter;
public execute() {
// do something
}
public String getParameter() {
return parameter;
}
public void setParameter(String parameter) {
this.parameter = parameter;
}
}
My pages.xml looks like this:
<pages>
<page view-id="/action.execute.xhtml"
action="#{action.execute}">
<param name="parameter" value="#{action.parameter}"/>
</page>
</pages>
If I call this page with a request parameter while not being logged in I get a
NotLoggedInException. I think the problem is that the exception is raised when accessing
the setParameter() during update model values and not during invoke application. So the
request parameters have never been applied to the model and therefore cannot be retrieved
in getViewRootValues(). If I remove the @Restrict to the action method it works fine but
then the set parameter method is not protected anymore.
Maybe it's just me being stupid but this behaviour is not obvious to me. From the
documentation (and the naming of the elements in pages.xml) I would have thought that the
original request values from the HttpServletRequest are saved _before_ they are applied to
the model and then these used to replace the values of the successful login request during
#{redirect.returnToCapturedView}.
If I understand the jsf documentation correctly this behaviour is not easy to fix because
request map is immutable and there is no way to push the captured request parameters
through the validators and converters after returing to the captured view. But there
should be a warning in the documentation not to use the page params with @Restrict on
class level. Maybe it would even be possible to throw different exception than NotLoggedIn
when an @Restrict-Annotation is encountered while applying the param values defined in
pages.xml to the model during the update model phase of a page action.
Regards
Felix
Page parameters not working on captured in
#{redirect.captureCurrentView}
-------------------------------------------------------------------------
Key: JBSEAM-1083
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1083
Project: JBoss Seam
Issue Type: Bug
Components: Security
Affects Versions: 1.2.0.GA
Environment: Windows XP, JDK 1.6.0, JBoss 4.2.1.CR1
Reporter: Felix Ho?feld
The page params defined in pages.xml are not saved during the call to
captureCurrentView.
I ran this through the debugger and traced the bug down to
org.jboss.seam.core.Pages.getViewRootValues(FacesContext facesContext). Things go wrong
when retriving the page parameters:
Code:
for ( Param pageParameter: page.getParameters() )
{
Object object = Contexts.getPageContext().get( pageParameter.getName() );
if (object!=null)
{
parameters.put( pageParameter.getName(), object );
}
}
It loops correctly over my parameters but it fails to retrieve them:
pageParamter.getName() delivers the name of my parameter correctly but but
Contexts.getPageContext().get() always returns null. So nothing is ever put into the
parameters map.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira