Create the integrated application (XPageApplication)

The extended Lutece Pages(XPage)

In Lutece, we can distinguish two types of page :

  • the classic pages assembled by portlets. It concerns most pages on the website.
  • Extended Pages which have a particular management scheme which facilitates application realisation due to to its flexible approach.

The Applications made of XPages can add features such as :

  • a search engine
  • the forms (contact, newsletter, formengine)
  • the site plan
  • ...

The applications are thus completely binded to the site. They consists of menus, banners, style sheets of the portal. Their graphical appearance will also change during a website upgrade thus no additional work is needed.

Technical description

An extended page can be distinguished when the url of the page has a page parameter and not id_page as classical pages of the site.

For exemple, http://myhost/lutece/jsp/site/Portal.jsp?page=map to obtain the site map.

The parameter specified the plugin name containing the XPageApp.

Note : By convention, we design this parameter in the form : <xpage>.

JAVA treatment

When the parameter <page> is detected in the request, the class fr.paris.lutece.portal.web.PortalJspBean (entry page of Lutece) calls to the method :

public String getPage( HttpServletRequest request , int nMode )
of fr.paris.lutece.portal.service.XPageAppService class. The service will look for the plugin whose name is specified in the parameter page in the request and fetch it from an instance of the XPageApp class.

All the XPageApp must be implement the interface : fr.paris.lutece.portal.web.xpages.XPageApplication.

It defines the following method :

public String getContent( HttpServletRequest request, int nMode, Plugin plugin );

which returns the page content relative to the parameters contained in the request, of mode (normal or administration) and the instance of the plugin for which it was instanciated. (The same class can be instanciated in different contexts).

XPageService calls this method and fills a structure XPage with the XPage's own data :

  • title of the page in the browser title bar
  • htm content in the page (described previously)
  • the navigation path : "You are Here" with the the context path
  • the key words associated to the page(used by search engines)

JSP

If the XPageApp developed needs an additional processing JSP (such as sending a message to the contact page), the JSP should be placed in the folder : portal/jsp/site/plugins/<myplugin>. The only imposed ruled is inclusion in the file header :

<%@ page errorPage="../../ErrorPagePortal.jsp" %>
<jsp:include page="../../PortalHeader.jsp" />

Access to the page

There is no automatic links towards the XPages on Lutece.

Normally, the XPages are accessible from the menu situated on the banner.

Adding an extended page from a properties file do not add automatically the XPage in the menu. The menu is a static menu, the links are written in hard in the template : dur dans le template : WEB-INF/templates/skin/site/page_menu_tools.html.

A LinkService allows to insert from a Wysiwyg HTML editor an article or an HTML portlet, alink towards XPages on the web site.

Page Administration

Administrative functions are generally needed to manage the backoffice fetaures.

To create for the same plugin, administrative functions [ HOWTO - Create functions d'administration ]

XPage definition in plugin configuration

The application must be declared in the XML file of the plugin as follows :

    <!-- Application XPage -->
    <application>
           <application-class>fr.paris.lutece.plugins.myplugin.web.MyPluginApp</application-class>
           <application-roles>role1,role2</application-roles>
    </application>
                       

Notice

The XPages are not indexed by the Lucene search engine.They will,thus, not be visible by a search from the home page.