2 Replies Latest reply on Apr 22, 2007 12:33 PM by yadong

    HELP! get exception when add @Restrict(

    yadong

      When I add @Restrict("#(identity.loggedIn)") to an Action (session bean) in class level, it throws exception when it is called.

      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("testAction")
      @Restrict("#(identity.loggedIn)")
      public class TestAction implements Testing {
      ...
      public String getName(){
      return name;
      }
      }

      in JSF page:

      <h:inputText id="test" value="#{testAction.name}" />



      Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
      at org.jboss.seam.security.Identity.evaluateExpression(Identity.java:507)
      at org.jboss.seam.security.Identity.checkRestriction(Identity.java:151)
      at org.jboss.seam.interceptors.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:35)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
      at org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:52)
      at org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$c3424f41.getSearchString()
      ... 58 more


      if I remove the @Restrict("#(identity.loggedIn)") , or replace it by:
      @Restrict("#{s:hasRole('admin')}")
      it is running well without execption