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?

> 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?

I hope I'm not too much of a burden using you as a climbing rope on my shale
learning curve ;-)

Cheers,
Joost
JS Portal
Dasstraat 21
2623CB Delft
the Netherlands
W: www.jsportal.com
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Craig
McClanahan
Sent: Wednesday, January 24, 2007 4:53 PM
To: user@shale.apache.org
Subject: Re: Starting A DialogContext Programmatically

On 1/23/07, JS Portal Support <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a ViewController which in it's prerender checks if the user in the
> session is logged or not. If not, I want to start a subdialog logging the
> user in.
>
> On page http://shale.apache.org/shale-dialog/index.html at: "Starting A
> DialogContext Programmatically" it is described how I can do this. I don't
> understand it though. Do I need to build my own DialogContextManager and
> DialogContext as they seem to be interfaces? Or are there implementations
> I
> can use, and if so, where can I find them? An example would be great!


The "shale-test-dialog-basic" and "shale-test-dialog-scxml" test webapps
(they are built nightly along with the framework) have an example of this
use case.  One nice feature is that the application coding is the same no
matter which implementation you use.

The DialogContextManager instance is created for you by the framework, so
all you will need to do is acquire a reference to it, and then ask it to
create you a DialogContext instance like this:

    FacesContext context = FacesContext.getCurrentInstance();
    DialogContextManager manager = (DialogContextManager)
      context.getApplication().getVariableResolver().
      resolveVariable(context, Constants.MANAGER_BEAN);
    DialogContext dcontext = manager.create(context, "myDialogName");
    dcontext.start(context);

You do not have to do anything else about storing the DialogContext
instance, because the manager will have taken care of that for you.

By the way, the reason for using the variable resolver, in the code example
above, is because the dialog framework defines the manager as a managed
bean.  Doing things this way (instead of just checking the write scoped
attributes) causes the manager to be created if it does not already exist.


By the way, is this a good architecture approach, checking the logged status
> on prerender and preprocess? Or are there other better ways to do this?


The only thing I would be concerned about is navigation -- I haven't
personally tested whether you can successfully navigate (say, to a login
page) from the prerender() method.  If that works for you, then this seems
like a reasonable approach.

Thanks,
> Joost Schouten
>
>
>
Craig

Reply via email to