Hi, great help and making slow progress. I've been breaking my head all day
on this programmatic dialog though.
When I start my dialog though a commandLink, all goes fine, and this is what
my log shows (jsportal=debug and org.apache.shale=debug altered for email a
bit):
(Logon.java:144)Logon will return authenticated
(BasicDialogContext.java:363) - advance(id=1, name=AuthenticateUser,
outcome=authenticated)
(jsportal.PortalBaseViewController.java:146) - findStoredView() called. View
stored:
(jsportal.PortalBaseViewController.java:153)no_view_stored will be returned
as no STORED_VIEW is found
(BasicDialogContext.java:523) - stop(id=1, name=null)
(ViewViewHandler.java:282) - setupViewController(/jsp/dashboard.jsp,false)
.... all doing what it should do as defined in my below dialog[1]
When I start the AuthenticateUser programmatically the user gets nicely
redirected to the logon.jsf when not logged. Then after logon, no further
execution of the dialog seems to happen. My log shows of this situation:
(Logon.java:144) - Logon will return authenticated
(LifecycleListener.java:604) -
ServletRequestAttributeRemoved(org.apache.shale.view.PHASE_ID,INVOKE_APPLICA
TION(5))
(LifecycleListener.java:538) -
ServletRequestAttributeAdded(org.apache.shale.view.PHASE_ID,RENDER_RESPONSE(
6))
(PortalBaseViewController.java:92) - prerender() called on:
com.jsportal.projectportal.web.JSFaces.Logon
.... and just the logon will be shown again with that difference manual
navigation to the dashboard.jsf will now be permitted because I'm logged.
I'm lost and don't know what else to try after about 8 hours of banging my
head on the keyboard ;-)
Thanks
Joost
[1] dialog:
<dialog name="AuthenticateUser" start="CheckLogged">
<action name="CheckLogged" method="#{logon.isLogged}">
<transition outcome="not_logged" target="LogonPage"/>
<transition outcome="logged" target="FindStoredView"/>
</action>
<view name="LogonPage" viewId="/logon.jsp">
<transition outcome="authenticated"
target="FindStoredView"/>
<transition outcome="unauthenticated" target="LogonPage"/>
<transition outcome="discontinued_account"
target="LogonPage"/>
</view>
<action name="FindStoredView" method="#{logon.findStoredView}">
<!--if it holds the stored view, it will navigate there from
the holdsStoredView method-->
<transition outcome="holds_stored_view" target="Exit"/>
<transition outcome="no_view_stored" target="Enter"/>
</action>
<end name="Enter" viewId="/jsp/dashboard.jsp"/>
<end name="Exit"/>
</dialog>
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Craig
McClanahan
Sent: Thursday, January 25, 2007 5:22 AM
To: [email protected]
Subject: Re: Starting A DialogContext Programmatically
On 1/24/07, JS Portal Support <[EMAIL PROTECTED]> wrote:
>
> Okay,
>
> For some reason my shale jar's didn't have the DialogContextManager and
> DialogContext interfaces in them. I downloaded the latest 1.0.4 ;-) and
> that
> solved it. Now I can't get to my data anymore without logging in. Jeee!
>
> Is there a problem with the .getVariableResolver() being depreciated by
> the
> way? What would be the new preferred way?
The issues with using the getVariableResolver() approach are:
* The application is getting involved with the internal "plumbing" of the
implementation, including depending on the managed beans facility
to create the manager if it does not exist.
* The application is required to be aware of the key under which the
DialogContextManager is stored, and what scope it is in.
* Because the knowledge is scattered all over an application, it would
be essentially impossible to modify the technique inside the framework.
In 1.0.4, the approach I described is the only one that works, and it will
continue to work in later versions. In the nightly builds, last night I
checked in a helper class that makes life a lot easier:
public class DialogHelper {
// Return the active DialogContext (if any)
public static DialogContext getDialogContext();
public static DialogContext getDialogContext(FacesContext context);
// Return the DialogContextManager, creating if needed
public static DIalogContextManager getDialogContextManager();
public static DialogContextManager
getDialogContextManager(FacesContext context);
}
so you end up with very simple calls like:
DialogContextManager manager = DialogHelper.getDialogContextManager();
with all the implementation details hidden away.
> I haven't personally tested whether you can successfully navigate (say, to
> >a login page) from the prerender() method.
> It works. When a user tries to access without being logged, the
> Authenticate
> dialog is started from the prerender. But now, how can I make my user
> return
> to the initial view which started up the Authenticate dialog. The user
> gets
> logged on but gets to see the logon.jsp once the Authenticate dialog is
> done. Is there a way to create a dialog programmatically, like you
> described, moving the user to the view on which prerender is called and
> then
> set the Authenticate as a child so that after authenticate, the user will
> be
> redirected back to the initial view?
Something along the following lines ought to work:
* In the view that starts the authentication dialog, save the view id in a
session scope variable.
* At the end of the authentication dialog, execute an action method that
looks up the saved view id (if any), and navigates programmatically
instead of using a normal view state.
I hope I'm not too much of a burden using you as a climbing rope on my shale
> learning curve ;-)
Nah, it is fun to answer interesting questions :-)
Cheers,
> Joost
Craig