Howdy,
You can map servlets in your web.xml to almost any URL pattern you want.

If your webapp is installed under the ROOT context, add the following
into your web.xml:
<servlet>
  <servlet-name>fooServlet</servlet-name>
  <servlet-class>fooName</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>fooServlet</servlet-name>
  <url-pattern>/foo</url-pattern>
</servlet-mapping>

See the Servlet Spec, section 11 "Mapping Requests To Servlets", for
full details.

If after reading the spec you conclude it's insufficient, you can always
place simple HTML forwarding files, e.g.
<html>
<head>
<meta http-equiv=REFRESH content="0; URL=/servlet/fooName">
</head>
</html>
where you need them.

And if all the above doesn't meet your needs, you're probably better off
adding apache or another server that does fancier URL-rewriting for you
;)

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Colin Chalmers [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, June 06, 2002 11:43 AM
>To: [EMAIL PROTECTED]
>Subject: Url rewrite
>
>Hi,
>
>I've been searching for info concerning url rewriting/mapping with
Catalina
>but can't seem to find a definitive answer (except to use Apache with
>mod-rewrite).
>
>Problem
>
>I would like to access a servlet
>(http://localhost:8080/fooDir/servlet/fooName) with a *nice* name such
as
>http://localhost:8080/foo
>
>I've found info whereby server.xml can be changed to map foo to fooDir
and
>something similiar in the web.xml but I have to say that I got lost in
the
>mountain of answer attempts, each time proposing a (slightly) different
>solution.
>
>Can it be done? If so who can show me the light?
>
>Thx in advance
>
>/Colin
>
>
>--
>To unsubscribe, e-mail:   <mailto:tomcat-user-
>[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:tomcat-user-
>[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to