-
1. Re: User specific redirect on login
shane.bryzak Nov 10, 2008 1:32 PM (in response to umajeric)Why wouldn't this still work?
-
2. Re: User specific redirect on login
accless Nov 10, 2008 1:48 PM (in response to umajeric)same problem with me. the redirect does not work properly anymore in seam 2.1.
-
3. Re: User specific redirect on login
umajeric Nov 10, 2008 6:51 PM (in response to umajeric)I think this is because currentUser is set at wrong time, at:
@Observer(JpaIdentityStore.EVENT_USER_AUTHENTICATED) public void loginSuccessful(User user) { Contexts.getSessionContext().set("currentUser", user); }
Because redirect was already sent at that time. Correct me if am I wrong?
-
4. Re: User specific redirect on login
zeppelinux.dmitry.diligesoft.com Nov 10, 2008 10:15 PM (in response to umajeric) -
5. Re: User specific redirect on login
shane.bryzak Nov 11, 2008 2:34 AM (in response to umajeric)That event is raised during the authentication process, before the redirect occurs.
-
6. Re: User specific redirect on login
shane.bryzak Nov 11, 2008 2:49 AM (in response to umajeric)I just tested the seamspace example in latest SVN trunk and redirect works fine. I added the following rule:
<page view-id="/home.xhtml"> <navigation from-action="#{identity.login}"> <!--rule if-outcome="loggedIn"> <redirect view-id="/profile.xhtml"/> </rule--> <rule if="#{identity.loggedIn and authenticatedMember ne null}"> <redirect view-id="/profile.xhtml"/> </rule> </navigation> <navigation from-action="#{register.start}"> <redirect view-id="/register.xhtml"/> </navigation> </page>
This caused the user to be redirected to the profile page after login, as expected. If you're having trouble with redirect after login, can you please try the seamspace example also to see if it has the same problem.
-
7. Re: User specific redirect on login
umajeric Nov 11, 2008 8:52 AM (in response to umajeric)I just tried the seamspace example with your settings
<page view-id="/home.xhtml"> <navigation from-action="#{identity.login}"> <!--rule if-outcome="loggedIn"> <redirect view-id="/profile.xhtml"/> </rule--> <rule if="#{identity.loggedIn and authenticatedMember ne null}"> <redirect view-id="/profile.xhtml"/> </rule> </navigation> <navigation from-action="#{register.start}"> <redirect view-id="/register.xhtml"/> </navigation> </page>
but after login I am not redirected to register.seam, but to home.seam (same page on witch I was logging in).
-
8. Re: User specific redirect on login
shane.bryzak Nov 11, 2008 9:12 AM (in response to umajeric)You should actually be redirected to the profile page. Can you try with the latest SVN version?
-
9. Re: User specific redirect on login
zeppelinux.dmitry.diligesoft.com Nov 11, 2008 11:15 PM (in response to umajeric)I tried the version from trunk, but unfortunately It can't be deployed on Glassfish (9.1), fails on the first attempt to load the page.xml:
... [#|2008-11-11T14:10:40.894-0800|INFO|sun-appserver9.1|org.jboss.seam.Component|_ThreadID=33;_ThreadName=httpWorkerThread -4949-4;|Component: org.jboss.seam.core.init, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Init|#] [#|2008-11-11T14:10:41.167-0800|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=33;_ThreadName=h ttpWorkerThread-4949-4;_RequestID=4e02004a-c0ef-4909-a7e6-da9ab365673c;|WebModule[/list]PWC1275: Exception sendi ng context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener java.lang.NullPointerException: Cannot find URL from classLoader for news/dig.page.xml, loading from WebappClassLoader delegate: true repositories: /WEB-INF/classes/ ----------> Parent Classloader: EJBClassLoader : urlSet = [] doneCalled = false Parent -> java.net.URLClassLoader@349f8a at org.jboss.seam.deployment.FileDescriptor.<init>(FileDescriptor.java:27) at org.jboss.seam.deployment.AbstractScanner$Handler.getFileDescriptor(AbstractScanner.java:108) at org.jboss.seam.deployment.AbstractScanner$Handler.handle(AbstractScanner.java:65) at org.jboss.seam.deployment.AbstractScanner$Handler.handle(AbstractScanner.java:75) at org.jboss.seam.deployment.AbstractScanner.handleItem(AbstractScanner.java:182) at org.jboss.seam.deployment.URLScanner.handleDirectory(URLScanner.java:145) at org.jboss.seam.deployment.URLScanner.handleDirectory(URLScanner.java:140) at org.jboss.seam.deployment.URLScanner.scanDirectories(URLScanner.java:42) at org.jboss.seam.deployment.WarRootDeploymentStrategy.scan(WarRootDeploymentStrategy.java:63) at org.jboss.seam.init.Initialization.init(Initialization.java:705) at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4632) at org.apache.catalina.core.StandardContext.start(StandardContext.java:5311) at com.sun.enterprise.web.WebModule.start(WebModule.java:353) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:989) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:973) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:704) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1633) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1239) at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:182) at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:278) at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.ja va:1004) at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:991) at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:470) at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:182) at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper .java:308) at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:230)...
-
10. Re: User specific redirect on login
shane.bryzak Nov 12, 2008 2:19 AM (in response to umajeric)Does the jee5/booking example work in Glassfish, following the steps in the
Seam on Glassfish
chapter of the docs? -
11. Re: User specific redirect on login
swd847 Nov 12, 2008 4:21 AM (in response to umajeric)Try the following:
<page view-id="/login.xhtml" action="''.toString()" > <navigation from-action="#{''.toString()}"> <rule if="#{identity.loggedIn and !empty(currentUser.homePage)}"> <redirect view-id="#{currentUser.homePage}"/> </rule> <rule if="#{identity.loggedIn and empty(currentUser.homePage)}"> <redirect view-id="/home.xhtml"/> </rule> </navigation> </page>
This should also have the effect of not allowing you to get to the login page if you are already logged in.
-
12. Re: User specific redirect on login
swd847 Nov 12, 2008 4:23 AM (in response to umajeric)slight typo
action="''.toString()"
should have been
action="#{''.toString()}"
-
13. Re: User specific redirect on login
zeppelinux.dmitry.diligesoft.com Nov 12, 2008 7:23 AM (in response to umajeric)The ear can be deployed, once deployed it fails when i try to select hotel from the list:
Caused by javax.ejb.EJBTransactionRolledbackException with message: "" com.sun.ejb.containers.BaseContainer.mapBusinessInterfaceException(BaseContainer.java:1482) com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1396) com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316) com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:205) com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:83) $Proxy256.selectHotel(Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) org.jboss.seam.util.Reflections.invoke(Reflections.java:22) org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31) org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76) org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:43) org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54) org.javassist.tmp.java.lang.Object_$$_javassist_6.selectHotel(Object_$$_javassist_6.java) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329) org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274) org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59) org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65) org.jboss.el.parser.AstValue.invoke(AstValue.java:96) org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) org.jboss.seam.core.Expressions$2.invoke(Expressions.java:174) org.jboss.seam.navigation.Pages.callAction(Pages.java:708) org.jboss.seam.navigation.Pages.preRender(Pages.java:346) org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:562) org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:473) org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:146) org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116) com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144) javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
I'm not sure, but may be the fact that in my case there is war deployed (not ear as in the booking example) is a somehow affects the result?
-
14. Re: User specific redirect on login
umajeric Nov 12, 2008 9:31 AM (in response to umajeric)I just tried this but it seems it doesn't work. I am still geting the login page even if I'm logged in.