From XPages to Web App Part Thirteen: Application Structure

Home » From XPages to Web App Part Thirteen: Application Structure

Table of Contents
Introduction
Part One – The Application
Part Two – XPages Advanced 1
Part Three: XPages Advanced Database Separation
Part Four: XPages Advanced Document Wrapper
Part Five: XPages Advanced MVC Controller
Part Six: Use of OpenNTF Domino API
Part Seven: OSGi Application Development Introduction
Part Eight: OSGi JAX-RS REST Access with ODA
Part Nine: OsgiWorlds
Part Ten: Vaadin
Part Eleven: OsgiWorlds Document Wrapper
Part Twelve: Key Date Page
Part Thirteen: Application Structure
Part Fourteen: Calendar View
Glossary

In the last part I looked in depth at the Key Date view/edit form. Much of the terminology of the components on the page would have been familiar to XPages developers – setRequired(), setImmediate() and a ValueChangeListener. Now I’m going to look at the structure of the application itself.

Vaadin applications are single page web applications. Any XPages developer who has used the XPages Mobile Single Page Application component may feel that can be rather restrictive. But the enter() method in the Java class for each page means greater flexibility to determine what happens when a page is navigated to. uk.co.intec.keyDatesApp.MainUI is the “single page” for the application This is defined in the WebContent\WEB-INF\web.xml:

    <servlet>
<servletname>KeyDatesServlet</servletname>
<servletclass>org.openntf.osgiworlds.ODA_VaadinServlet</servletclass>
<initparam>
<paramname>UI</paramname>
<paramvalue>uk.co.intec.keyDatesApp.MainUI</paramvalue>
</initparam>
</servlet>

 

As I mentioned when covering OsgiWorlds in Part Nine, Vaadin runs as a servlet and uses ODA_VaadinServlet. The single page for the application has the parameter name UI and this is where it’s mapped to the MainUI class. With the 3.0 servlet specification, the web.xml can be skipped and these settings can be configured using @Annotations in the MainUI class itself, but unfortunately Domino does not support that specification (and is unlikely to for some years). With Websphere Liberty Profile and CrossWorlds I could use @Annotations, but to minimise the differences, when iit comes to CrossWorlds, I will still use the web.xml.

So, back to the MainUI class, in the init() method, the application is made responsive, the header and body added, the error page specified and a Navigator defined. If the user is not authenticated or the database doesn’t exist, the Home page is displayed. This means users cannot navigate directly to sub-pages, because anonymous access is not allowed. With the app running on the Domino server, that means the user needs to be authenticated to the Domino server or a Domino application to access it. Of course, more sophisticated application-level security could be coded.

The pages are in the uk.co.intec.keyDatesApp.pages package. Each page follows a similar format:

  • They have a VIEW_NAME static property that defines the URL for that page (e.g. Calendar for the calendar page, whose URL will be “keyDates/?#!Calendar”
  • the constructor does very little
  • on entering, if the content has not previously been loaded (so it’s the first time the user has navigated to the page), the content is loaded.

In the next part I will cover the Key Dates and Calendar pages for navigating Key Dates.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top