The Jakarta Project
      The Apache Jakarta Tomcat Servlet/JSP Container

The Apache Jakarta Tomcat 5.5 Servlet/JSP Container

SSI How To

Introduction

SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology.

Within Tomcat SSI support can be added when using Tomcat as your HTTP server and you require SSI support. Typically this is done during development when you don't want to run a web server like Apache.

Tomcat SSI support implements the same SSI directives as Apache. See the Apache Introduction to SSI for information on using SSI directives.

SSI support is implemented using the servlet class org.apache.catalina.ssi.SSIServlet. Traditionally, this servlet is mapped to the URL pattern "*.shtml".

By default SSI support is disabled in Tomcat.

Installation

CAUTION - SSI directives can be used to execute programs external to the Tomcat JVM. If you are using the Java SecurityManager this will bypass your security policy configuration in catalina.policy.

Rename $CATALINA_BASE/server/lib/servlets-ssi.renametojar to $CATALINA_BASE/server/lib/servlets-ssi.jar.

Remove the XML comments from around the SSI servlet and servlet-mapping configuration in $CATALINA_BASE/conf/web.xml.

Configuration

There are several servlet init parameters which can be used to configure the behaviour of the SSI servlet.

  • buffered - Should output from this servlet be buffered? (0=false, 1=true) Default 0 (false).
  • debug - Debugging detail level for messages logged by this servlet. Default 0.
  • expires - The number of seconds before a page with SSI directives will expire. Default behaviour is for all SSI directives to be evaluated for every request.
  • isVirtualWebappRelative - Should "virtual" SSI directive paths be interpreted as relative to the context root, instead of the server root? (0=false, 1=true) Default 0 (false).


Copyright © 1999-2005, Apache Software Foundation