Ask the Expert

Changing the servlet context in Apache 5.x

In Apache 5.0 and 5.5, for every program, I need to change the servlet name, class name, etc in the web.xml file. This doesn't seem to the case in Apache Tomcat 4.0. Why?

    Requires Free Membership to View

According to the Tomcat 5.0 release notes:

"Having CGI and SSI available to web applications created security problems when using a security manager (as a malicious Web application could use them to sidestep the security manager access control). In Tomcat 5.0, they have been disabled by default, as our goal is to provide a fully secure default configuration. However, CGI and SSI remain available.

To enable CGI:

  • rename the file $CATALINA_HOME/server/lib/servlets-cgi.renametojar to $CATALINA_HOME/server/lib/servlets-cgi.jar.
  • in $CATALINA_HOME/conf/web.xml, you will need to uncomment 2 areas, the servlet declaration and the servlet mapping. The servlet declaration looks similar to this:

    <servlet>
        <servlet-name>cgi</servlet-name>
        ...
    </servlet>

While the servlet mapping looks similar to this:

    <servlet-mapping>
        <servlet-name>cgi</servlet-name>
        <url-pattern>/cgi-bin/*</url-pattern>
    </servlet-mapping>

Alternately, these servlet declarations and mappings can be added to your Web application deployment descriptor.

To enable SSI:

  • * rename the file $CATALINA_HOME/server/lib/servlets-ssi.renametojar to $CATALINA_HOME/server/lib/servlets-ssi.jar.
  • in $CATALINA_HOME/conf/web.xml, you will need to uncomment 2 areas, the servlet declaration and the servlet mapping. The servlet declaration looks similar to this:

    <servlet>
        <servlet-name>ssi</servlet-name>
        ...
    </servlet>

While the servlet mapping looks similar to this:

    <servlet-mapping>
        <servlet-name>ssi</servlet-name>
        <url-pattern>*.shtml</url-pattern>
    </servlet-mapping>

Alternately, these servlet declarations and mappings can be added to your Web application deployment descriptor."

This was first published in October 2005

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: