tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Diggins" <subscri...@red56.co.uk>
Subject RE: servlet alias
Date Sun, 30 Jul 2000 00:06:49 GMT
Hi Chris --

first thought (probably wrong!)

can't you just add an extra "context" entity into your server.xml? Or does
that only work for directories?

        <Context path="/MyServlet"
docBase="application/servelt/org.tasteit.MyServlet" debug="0"
reloadable="true" >
        </Context>

(Can't get rid of the 8080, however, that's a TCPIP thing).

----------------

On second thoughts, make it part of a web-app, and amend the web.xml file.

Here's a snip, from the default web-app provided:
In there's your answer.

If you look at the standard install - the ROOT web-app manages to grab the
context for "/" no path

[snip]
<!-- Define mappings that are used by the servlet container to
         translate a particular request URI (context-relative) to a
         particular servlet.  The examples below correspond to the
         servlet descriptions above.  Thus, a request URI like:

           http://localhost:8080/{contextpath}/graph

         will be mapped to the "graph" servlet, while a request like:

           http://localhost:8080/{contextpath}/saveCustomer.do

         will be mapped to the "controller" servlet.

         You may define any number of servlet mappings, including zero.
         It is also legal to define more than one mapping for the same
         servlet, if you wish to.
    -->

    <servlet-mapping>
      <servlet-name>controller</servlet-name>
      <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
      <servlet-name>graph</servlet-name>
      <url-pattern>/graph</url-pattern>
    </servlet-mapping>

------------------------

Third thought is to do the mapping from apache or whatever webserver you're
using (relatively trivial to do the mapping in apache, probably more complex
to go through the business of integrating apache to tomcat if what you're
doing is, like me, using tomcat standalone to get to the gritty stuff
quickest).



Hope those musings help.


Mime
View raw message