Application Startup - Parameters/URI handling

I’m entering an area that I really know nothing about - I could use some help getting started…

I have an application that starts up by displaying a standard login page. When the user enters a name and password, they get taken to a ‘Dispatcher’ page which then allows them to choose graphs that get computed and displayed. Works great…

I would like to modify the program to allow a user to enter a URL that contains the name of the graph they want to see. The program should then bypass the login
sequence and essentially do the following:

  1. Log them in as an ‘anonymous’ user (with the associated restricted privileges)
  2. Bypass the selection page
  3. Display the named graph

So today, my URL looks like:

http://myHost/myProgramName

I would like to allow:

http://myHost/myProgramName?graphName

and have it go directly to the graph page.

And this is where my knowlege ends. Do I want to do this with a ParameterHandler or a URIHandler? Why? :slight_smile:

I tried creating a simple parameter handler, and attached it to my main window in the init() routine. It appears to get called multiple times (sometimes once, sometimes twice) after the init routine completes - what triggers a call to the parameter handler? When is it called?

Ideally, I would like to leave the anonymous user logged in to the program after displaying the graph, so that in theory, they could return to the selection page and pick up another graph just as if they were a regular user (Again, their permissions would be reduced so modifying data won’t be allowed, but that is a function of the user itself)

I could use some pointers to documentation or examples - I’m looking through the Book of Vaadin and I have found some information, but I have not absorbed it all yet…

Thanks,

nbc

Perhaps if I rephrase the question, someone can point me in the right direction…

My web app loads a login page when the user points a browser at my URL. After providing a user name and password, the user is transferred to the main program screen.
I would like to allow a user to provide a parameter on the URL line. When that happens, I would like to skip the login and do 2 things:

  1. Log the user in as an ‘anonymous’ user automatically
  2. Transfer to my main page with the information from the URL parameter

I have been able to create a ParameterHandler class that will correctly pick up the parameter from the URL - something like:

http://myHost/myProgramName?abc=def

The parameter handler picks up the abc=def parameter. It looks like this handler gets called AFTER the call to my init() routine.

However, the init routine loads my login page. And after submitting the login page, the parameter handler appears to get called again - with both my username and
password provided as parameters.

My init routine looks like this:


@Override
    public void init() {
        setTheme("JART");
        setAppTitle("JART");

        mainWindow = new Window("JART");
        mainWindow.setName("JART");
        setMainWindow(mainWindow);
        anonymousUser = false;
        
        mainWindow.addParameterHandler(new JART_ParamHandler(this));
        
        aboutBox = new AboutBox("JART 0.5", "JART Graph Viewer");
        
        // Initialize configuration properties
        initProperties();
        
        // Initialize JART specific properties, including database, RRD Host etc.
        initJARTProperties();
        
        // Initialize View manager
        viewManager = new ViewManager(mainWindow);
        
        // Create Login screen
        viewManager.switchScreen(LoginScreen.class.getName(), new LoginScreen(this));
}

My specific questions are these:

  1. Why is the Parameter Handler called multiple times - once after the init() and once in Login window? I’m using a Login page that I got from Vaadin long
    ago - includes some html code and a login handler that I customized to work with my database arrangement…

  2. How can I get the Parameter Handler called before putting up the login screen? I would like to bypass that screen if there is a valid parameter on the browser
    command line

Thanks very much,

nbc