LSPS documentation logo
LSPS Documentation
Customizing Behavior

Browser Session Timeout

When the user becomes inactive, the countdown of the session timeout period starts. The countdown keeps running until the user clicks into the UI including clicking empty space or focusing a field. Once the countdown has lapsed, the session is considered inactive and is destroyed by the respective service, which runs every 5-6 minutes or so.

Session timeout is set in minutes in the <session-timeout> element in the <YOUR_APP>-vaadin-war/web.xml project. Set it to -1 to disable it.

<session-config>
    <session-timeout>15</session-timeout>
</session-config>

Note on Websphere's LTPA tokens: Authentication on Websphere is done via LTPA tokens, which define their expiration time. The expiration time is not influenced by user activity.

If a session expires while the LTPA token is valid, the user remains logged in: Next time the user accesses the application, they are assigned a new session, but as their LTPA-token cookie is still valid, they are logged in to the application automatically.

Customizing Authentication

You can customize the authentication to the Application User Interface in the AppUIProvider class: by default, getUIClass(), that serves the UI, checks whether the user is logged in and if this is not the case, it checks whether the user exists and is active. Adapt the method as required.

Setting the Home Page

To set the page which is loaded after the user has logged in and when they click the logo, modify openHomePage() of the LspsUI class:

  • sets to a view:
    public void openHomePage() {
      navigateTo(<VIEW>.ID);
      // for example:
      // navigateTo(getNavigator().documentsViewId());
    }
    
  • sets to a document:
       public void openHomePage() {
        openDocument("<FULLY_QUALIFIED_DOCUMENT_NAME>", null);
        //for example: openDocument("module::docMainScreen", null);
      }
    

Importing JavaScript

Important: We strongly recommend to use JavaScript sparingly and exclusively *with the aim to change the presentation layer of your application.

To add a JavaScript to your custom application, do the following:

  1. Add your JavaScript file to the <YOUR_APP>-vaadin-war/src/main/webapp/VAADIN/js/ directory.
  2. Annotate the LspsUI class of your custom application as follows:
    @com.vaadin.annotations.JavaScript({ "vaadin://js/<YOUR_JS>.js" })
    
    For example:
    @com.vaadin.annotations.JavaScript({ "vaadin://js/hello.js" })
    
  3. Build and deploy the application.
  4. Check if the script is available under http://localhost:8080/myproject/VAADIN/js/test.js