-
1. Re: Nesting the Login Conversation
christian.bauer Mar 14, 2006 5:20 AM (in response to tim.brewer)I had asked myself a similar question last week, we are basically looking for a way to do History and History* (UI statechart stuff we talked about in the early days of Seam).
-
2. Re: Nesting the Login Conversation
tim.brewer Mar 15, 2006 9:51 AM (in response to tim.brewer)Well I've done it, but only by storing the outcome in the session context and then firing it when the login or register process is complete.
Surely this sort of process is what nested conversations are made for ?
Cheers,
Tim. -
3. Re: Nesting the Login Conversation
gavin.king Mar 16, 2006 12:02 AM (in response to tim.brewer)Have you looked at how the issue tracker demo handles the login challenge? I think that is pretty elegant.
(It uses Conversation.redirect().) -
4. Re: Nesting the Login Conversation
gavin.king Mar 16, 2006 12:57 AM (in response to tim.brewer)"tim.brewer@iblocks.co.uk" wrote:
Surely this sort of process is what nested conversations are made for ?
Actually, no, they are more meant for things like master/detail views. -
5. Re: Nesting the Login Conversation
tim.brewer Mar 16, 2006 5:51 AM (in response to tim.brewer)Thanks, Gavin, that approach is much more elegant than my fudge. I'll engineer that in.
However, I'm a stage down the login process and have hit another issue; If the user has bookmarked a page e.g.
http://seam.demo.jboss.com/main.seam
They can jump directly to this page without any login challenge. Admittedly they can't do much when they get there but it is a bit confusing.
I would rather they were forwarded to the login screen, but the @LoggedIn interceptor isn't fired & even if the interceptor was fired (e.g. via a factory or method call on the page) I wouldn't be able to specify an outcome for redirection.
I'm currently looking at the NavigationHandler to see if this will do the job. I'm new to JSF so I'm open to any better / alternative solutions.
Cheers,
Tim. -
6. Re: Nesting the Login Conversation
gavin.king Mar 16, 2006 6:34 AM (in response to tim.brewer)Yes, this is because of the JSF lifecycle for non-faces requests (there is no action). I don't think you can solve this with a NavigationHandler - the NavigationHandler is only called to translate an action outcome to a viewid. When you hit main.seam directly, you already know the viewid.
I believe you *can* solve it with a PhaseListener, but you will need to do something like this:UIViewRoot viewRoot = context.getApplication().getViewHandler() .createView( context, "login.jsp" ); context.setViewRoot(viewRoot);
Or, perhaps, something like this:String url = context.getApplication().getViewHandler().getActionURL( context, "login.jsp" ); url = encodeConversationId(url); ExternalContext externalContext = context.getExternalContext(); externalContext.redirect( externalContext.encodeActionURL(url) ); context.responseComplete();
Note that I have not tried either thing.