pages.xml, @Restrict and exception not working for me
monkeyden Apr 25, 2007 3:01 PMI'm trying to use the @Restrict annotation in an app originating from seam-gen (Seam 1.1.6). The org.jboss.seam.security.NotLoggedInException exception is correctly thrown but it looks like the page is half rendered, rather than redirecting to "/login.xhtml". Because it's half rendered, this presumably happens upon first access of the action, in which case it's too late to redirect. I also tried
<restrict>#{identity.loggedIn}</restrict>in pages.xml. I am also using ICEFaces. Thanks for any pointers.
@Name("editProfileAction") @Stateful @Scope(SESSION) @Restrict("#{identity.loggedIn}") public class EditProfileAction implements EditProfile { .... }
<exception class="org.jboss.seam.security.NotLoggedInException"> <end-conversation /> <redirect view-id="/login.xhtml"> <message>#{messages['please.login.first']}</message> </redirect> </exception>
14:58:44,208 ERROR [D2DFaceletViewHandler] Problem in renderResponse: Error evaluating expression [#{identity.loggedIn}] - User not logged in org.jboss.seam.security.NotLoggedInException: Error evaluating expression [#{identity.loggedIn}] - User not logged in at org.jboss.seam.security.Identity.checkRestriction(Identity.java:169) at org.jboss.seam.interceptors.SecurityInterceptor.checkSecurity(SecurityInterceptor.java:44) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.seam.util.Reflections.invoke(Reflections.java:18) at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64) at org.jboss.seam.interceptors.BijectionInterceptor.bijectNonreentrantComponent(BijectionInterceptor.java:79) at org.jboss.seam.interceptors.BijectionInterceptor.bijectComponent(BijectionInterceptor.java:58) at sun.reflect.GeneratedMethodAccessor3816.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.seam.util.Reflections.invoke(Reflections.java:18) at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64) at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21) at sun.reflect.GeneratedMethodAccessor3818.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.seam.util.Reflections.invoke(Reflections.java:18) at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64) at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:52) at sun.reflect.GeneratedMethodAccessor3815.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.seam.util.Reflections.invoke(Reflections.java:18) at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169) 14:58:44,255 INFO [STDOUT] afterPhase: PhaseEvent in JSFPhaseListener::javax.faces.event.PhaseEvent[source=org.apache.myfaces.lifecycle.LifecycleImpl@1af03a0] 14:58:44,255 INFO [STDOUT] afterPhase: phaseEvent.getPhaseId(): RENDER_RESPONSE(6)