tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Url rewrite
Date Thu, 06 Jun 2002 15:51:46 GMT
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:colin.chalmers@maxware.nl]
>Sent: Thursday, June 06, 2002 11:43 AM
>To: tomcat-user@jakarta.apache.org
>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-
>unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:tomcat-user-
>help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message