tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Emenaker" <...@emenaker.com>
Subject Re: Converting from JRun
Date Tue, 24 Oct 2000 22:39:12 GMT
> ie, in JRun, one would add a line to rules.properties
> such as:
>
> /url/   Yourservlet

Sounds like you're using an older JRun. The version of JRun I was playing
with recently seemed to conform pretty closely to the servlet 2.2 spec.

Anyway....

First off, you need to go to your /etc/tomcat/server.xml (or whatever it is
for you) and find the tags that say "<Context>". The format of a Context
block seems to be something like:

<Context path="/urlpart1"
     docBase="/someplace/on/my/hard/drive"
     reloadable="true" >
</Context>

This basically tells tomcat that, if someone asks for anything starting with
"/urlpart1", to go interact with the webapp at /someplace/on/my/hard/drive.
It should serve up html and images files from just about anywhere in that
directory just like any docroot in a normal webserver... except for the
WEB-INF directory.

Stuff in /someplace/on/my/hard/drive/WEB-INF is never served up directly.
There should be a web.xml file in there that let you define *more* url
mappings for individual servlets in your webapp. For example:

<web-app>
  <servlet>
    <servlet-name>
      SomeServletNameThatTheOutsideWorldNeverSees
    </servlet-name>
    <servlet-class>
      mypackage.MyServlet
    </servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>
      SomeServletNameThatTheOutsideWorldNeverSees
    </servlet-name>
    <url-pattern>
      /urlpart2
    </url-pattern>
  </servlet-mapping>
</web-app>

So, at this point, if you asked tomcat for "/urlpart1/urlpart2", it should
go to your /someplace/on/my/hard/drive directory, find the mapping of the
"/urlpart2" to a servlet that you, internally, refer to as
"SomeServletNameThatTheOutsideWorldNeverSees". It then finds out that the
actual class that this corresponds to is "mypackage.MyServlet" and it tries
to find that class in /someplace/on/my/hard/drive/WEB-INF/classes or in any
jar file in /someplace/on/my/hard/drive/WEB-INF/lib.

Clear as mud?

- Joe


Mime
View raw message