Altair EEvision™

Home

Installation with CGI on Tomcat


For the main documentation on installing EEvision on a Web Server with CGI support, please check out EEvision Installation with CGI. Here are some notes on how to configure the Tomcat Web Server. For more details, we refer to the official documentation of Tomcat.

Requirements for the Web Server configuration, (see Jetty and Apache configuration)

You have obtained an installation package for EEvision. Within the package, the files for a web server installation are located in the directory web/. The sub-directory web/srv/ contains the needed CGI programs, the directory web/img the images that are referenced by EEvision. An example EDB vehicle.edb plus accompanying SVG images is contained in the directory web/data/.

We assume that EEvision should be installed in the sub-directory webapps/eevision of the Tomcat installation. In the following $eev/ denotes this directory. Copy the contents of web/ with the exception of web/srv/ to the EEvision installation directory $eev. Create sub-directories $eev/WEB-INF/ and $eev/WEB-INF/cgi. Copy the contents of the directory web/srv/ to $eev/WEB-INF/cgi/.

Enabling CGI-Programs in “$eev/WEB-INF/cgi
<servlet>
    <servlet-name>cgi</servlet-name>
    <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
    <init-param>
      <param-name>executable</param-name>
      <param-value></param-value>
    </init-param>
    <init-param>
      <param-name>cgiPathPrefix</param-name>
      <param-value>WEB-INF/cgi</param-value>
    </init-param>
    <init-param>
      <param-name>environment-variable-EEV_DATA</param-name>
      <param-value>../../data</param-value>
    </init-param>
    <load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>cgi</servlet-name>
    <url-pattern>/srv/*</url-pattern>
</servlet-mapping>

EEvision requires that the execution of CGI programs is enabled in Tomcat. However, by default the CGI servlet is disabled. First we have to set privileged="true" on the Context element for the web application. Only Contexts which are marked as privileged are allowed to use the CGI servlet. Making the context privileged can either be done globally in conf/context.xml of the Tomcat installation or for EEvision only by copying the file conf/context.xml to $eev/META-INF/context.xml within the EEvision installation directory and setting privileged="true" there.

In the second step, we need to load the CGI servlet. We assume that the CGI-Programs are located in the $eev/WEB-INF/cgi sub-directory of the EEvision installation. For Tomcat, inserting the contents of the gray box into $eev/WEB-INF/web.xml enables the execution of CGI programs in the $eev/WEB_INF/cgi directory. Note that we need to specify the location of the data directory, which contains all EDB files and their accompanying SVG image files. To do so, we set the environment variable EEV_DATA to “../../data”. This value is the relative path (w.r.t. the CGI programs) to $eev/data, where we copied the provided example EDB. For more information, we refer to the CGI documentation of Tomcat.

Data Transfer Compression (optional)
Depending on the environment, compressing the transferred data may speed up the start-up and response time of EEvision (but may slow down on other environments). Here is a table that shows all mime types used by EEvision. The column “compress” is checked if we suggest compression on wide area networks.
file name
extension
mime type default
compress
.html text/html
.css text/css
.js application/javascript
.svg image/svg+xml
.png image/png
.gif image/gif
.wasm application/wasm
.json application/json
.conf application/json
.sym .nlv text/x-nlv
CGI Programs
responses
text/plain
application/json

Most of these mime types already map to the file name extensions by default on most Web Servers (checked in the “default” column) and if so, they don't need to be additionally declared. In Tomcat, data compression can be activated in the declaration of the HTTP connector in $TOMCAT_HOME/conf/server.xml. Please consult the Tomcat documentation for details.

Browser Caching (optional)
  <filter>
    <filter-name>ExpiresFilter</filter-name>
    <filter-class>org.apache.catalina.filters.ExpiresFilter</filter-class>
    <init-param>
        <param-name>ExpiresDefault</param-name>
        <param-value>access plus 30 seconds</param-value>
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>ExpiresFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
  </filter-mapping>

There are cache control strategies that delivers an expiration date to the Browser to make them silently caching the contents until it expires (some Browsers do, others don't). This expiration time should not be set too long, because there is no easy way to update the Browser before those resources expire. For Tomcat, the gray box on the right side – to be put into the web.xml configuration file in the application's WEB-INF directory – will set this expiration date to 30 seconds after access.

Start Page (optional)
<welcome-file-list>
  <welcome-file>fileselect.html</welcome-file>
</welcome-file-list>
If you want to make a certain html file your start page, you can define that to Tomcat as shown in the box on the right side – to be put into WEB-INF/web.xml. If so, Tomcat will deliver the fileselect.html (a simple file selection page) on the start URL http://server/eevision.

Copyright © 2020–2024 by Altair Engineering Inc.
All rights reserved.