Deploying Web Application Resources

In a J2EE-compliant web server, deploy the web resources used by the Uniface web application.

If you deploy using a .war, you need the Java J2EE installed.

Web applications require that some resources, such as images, cascading style sheets, static HTML pages, or other documents, be available in the web server itself, not via the Uniface Server.

These web resources can be deployed as directory, or as a web archive file (.war). A WAR file can only be used for a standalone web application, which includes the /WEB-INF directory containing the web.xml file with the Uniface servlet definitions and configuration.

During development, it is usual to deploy to a directory, because it is easy to update individual files. Using WAR files, you must regenerate and redeploy the entire WAR file. In a production environment, it is usually easier to deploy a single WAR file than update multiple files.

The web server treats the directory or .war file as a virtual root (also known as web site, virtual root, or document root). Any files that are outside of the virtual root are unavailable to the application. All references to files in server pages to these files are assumed to be relative to the virtual root. Hard-coded paths, such as D:\myresources\css, cannot be accessed by the web server.

  1. Create a physical directory to contain the web resource files and directories that need to be available in the virtual root.

    For example, in the default Tomcat installation, create the directory mywebapp in UnifaceInstallDir/common/tomcat/webapps/.

  2. Copy the /common and /css directories from UnifaceInstallDir/uniface/webapps/ for Uniface functionality and style sheets.
  3. Create or copy any subdirectories and any other files that the application requires into this directory.
  4. To package these files into a .war file:
    1. Create a WEB-INF subdirectory, and copy the Uniface web.xml file into it.
    2. Edit the web.xml file to suit your application and web environment. For more information, see Configuring the Uniface Web Application Server.

      Ensure that the WRD servlet’s parameter UseRunPrefix is set to False. This is the default.

      Do not use the servlet parameters ERRORDIR, RESOURCEDIR, and WEBAPPURL.

    3. Create a web application archive file (.war file) using the following command syntax:

      jar -cf WebApplication.war -CWebApplication

      For example:

      jar -cf mywebapp.war -C D:\mywebapp
  5. In the web server, define the application and its virtual root, or deploy the .war file (or directories), according to the web server documentation.
  6. If required, modify the $WEB_CODE_BASE setting in the assignment file of the Uniface Web Application Server. By default, this is the wasv.asn file located in UnifaceInstallDir/uniface/adm.

    This setting is applicable only in applications that use static server pages and that use the Java applet for browser-side syntax checking. The default location of this applet is the common directory. If you want to change this location, modify the $WEB_CODE_BASE assignment setting, which is used by the WASV to generate the correct applet tags in the HTML.

Related Topics