Create Web Application

From PresenceWiki
Jump to: navigation, search
Administration Client > Create Web Application


Introduction to creating Web Applications

In many cases, Presence web applications are run on an internal web server, which means the Presence system can run tasks called On Demand by the web server.

However, there may also be cases where, for reasons of security or convenience, the web server is physically isolated on the network from the Presence system, and therefore Presence tasks cannot be run. For example you may wish to create an application using Presence and then deploy it onto a PDA.

In this instance, you can still run Presence based applications on your web server by exporting them from the Presence System.

A Presence Web Application is a standalone copy of one or more Presence Tasks, which also includes the Presence execution engines (Primary/Slave server engines). The Web Application is exported as a .WAR file (Web ARchive) which can be installed and hosted on any web server that supports a Java Servlet container.

The WAR file container is similar to a standard JAR File in that it is simply a zip file format containing a compressed version of multiple Java class files, however, additionally it also includes a /WEB-INF folder that includes a web.xml file to define the structure of the web application. In the case of a Presence Web Application, the web.xml file defines how the servlet engine calls the Presence tasks contained in the Web Application.

Web Application Limitations

When you export one or more Presence tasks into a Web Application, the Presence Database engine is not exported. Only the execution engine (Primary/Slave server) is exported.

In order for the execution engine to run the tasks, the configuration of each task is exported in an XML format which can then be read and processed at run-time.

Because the database engine is not exported, any data that you wish to access must be maintained in a separate external database such as MySQL or SQL Server. This will usually mean exporting the JAR files for those JDBC drivers (see Libraries Tab below).

Also, any tasks that rely on comparison data - such as those that use Data Filters, or Object Monitors with the Deviation tab enabled - will not function. This should not pose a major problem as tasks that use comparison data are not good candidates for web applications. See Data Filter.

Creating A Web Application

From the Tools menu select Create Web Application. The Export Web Application dialog appears.

Introduction Tab

  • Create New / Update Existing radio button - select Create New to produce a new WAR file. See Update Existing below to update an existing WAR file.
  • Display Name for this Web Application - enter a name for the Web Application - e.g. "Sales App".
  • Description for this Web Application - here you can enter a description and documentation for your application.
  • Back / Next / Finish buttons - use Back and Next to navigate forwards and backwards through the tabs. Use the Finish button to create your WAR file.

Use the Next button or select the Tasks tab to proceed.

Tasks Tab

Here you select which Tasks you require in order to run your Web Application.

A minimum of one Task must be selected. Select a task by navigating to it in the Task Explorer pane and then dragging it across into the window on the right.

You can select an entire category by dragging the category.

Resources Tab

Here you select a folder which contains all of the resource files you require in order to run your Web Application. This can include JSP files, HTML pages, CSS (Cascading Style Sheet) files, images, or any other files required for a web application.

Note however that the JSP file format for exported web applications is different to the format for normal On Demand web tasks. See JSP file format for more details.

Browse... - Use this button to locate your resource folder.

Libraries Tab

Presence stores external Java classes or JAR's in the Presence Database. External JAR files or classes may be required by custom Presence Functions, JDBCJava Data Base Connectivity - Sun's open database connectivity platform for Java applications. Allows Java applications to seamlessly connect to any JDBC compliant databse. DBC is considered to be a robust, enterprise level databse connection standard and is therefore highly recommended for mission critical applications. Database Drivers, or other third party Java code.

Presence maintains these external JARs and Classes within the Presence database using the JAR Manager, but as the database is not exported in a web application (see Web Application Limitations above) you must export any Java classes and JAR files along with your web application.

The main pane of this dialog lists any and all JAR files that have been imported into the Presence database. If no JAR files have been imorted, then you will normally see just one JAR, which is com.internationalpresence.looseclasses.jar.

Note that unless you have imported a loose java .class file, this jar will be empty and you should not attempt to export it.

Select only those JAR files that you require for your web application.

Select All - Selects all availble Jar's in the list.

Deselect All - Deselects all available Jar's in the list.

Add External JAR - Allows you to browse to an external JAR file. Use this option if you need to add a JAR file that you have not imported into Presence.

Create WAR File Tab

Finally, select an output location for your new WAR file to be created.

  • Browse... - Use this button to identify the location where the WAR file will be created.
  • Create Web Application - This will generate a complete WAR file containing all the items selected in the previous screens. Note that selecting Finish will also prompt you to output the WAR file.
  • Just Replace Task Files - This option can be used to update a WAR file where the only changes that have been made are to the task design (ie, you do not need to change library files or resources).

Updating An Existing Web Application

From the Tools menu select Create Web Application. The Export Web Application dialog appears.

Introduction Tab

Create New / Update Existing radio button - select Update Existing to modify the contents of an existing WAR file. See Creating A Web Application to create a new Web Application.

Browse... - Browse to the location of a WAR file you previously created with the Presence Export Web Application option. The content of the WAR file are read into the export engine.

Back / Next buttons - use Back and Next to navigate forwards and backwards through the tabs.

Make any changes you need to make to the list of Tasks, Resources and Libraries for this Web Application.

Create WAR File tab

Finally, either recreate the Web Application, or just replace the Task Files.

Browse... - Use this button to change the location where the WAR file will be created. If you do not change the path, the existing WAR file will be updated.

Create Web Application - This will generate a complete WAR file containing all the items selected in the previous screens. Note that selecting Finish will also prompt you to output the WAR file.

Just Replace Task Files - This option can be used to update a WAR file where the only changes that have been made are to the task design (ie, you do not need to change library files or resources).

Back / Next buttons - use Back and Next to navigate forwards and backwards through the tabs.

Finish - Use the Finish button to create your WAR file and then end the export process.

Cancel - Use the Cancel button to exit out of the export process without saving your changes.

Example Web Application

Please see the Web Application Creation Tutorial for a step-by-step guide to creating and deploying a Web Application from Presence.


Architecture > Administration Client > Create Web Application

Task Explorer | Resources Explorer | Task Designer
Menu Options | Toolbar Items