tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William G. Thompson, Jr." <wgt...@tnt-web.com>
Subject Re: dynamic urls
Date Thu, 01 Aug 2002 13:08:35 GMT
On Thu, 1 Aug 2002, SB wrote:
> 
> Hi
> I want my URLs as
> http://localhost:8080/webapp/MyServlet/2345
> http://localhost:8080/webapp/MyServlet/23349
> http://localhost:8080/webapp/MyServlet/345
> 
> all mapped to the same servlet, none are static.
> 
> Note that I do not want:
> http://localhost:8080/webapp/MyServlet?23349
> which is straightforward, but
> http://localhost:8080/webapp/MyServlet/23349
> 
> How can I do it?

You want path mapping.  Something like:

<servlet-mapping>
  <servlet-name>myservlet</servlet-name>
  <url-pattern>/MyServlet/*</url-pattern>
</servlet-mapping>

This will forward all requests matching /webapps/MyServlet/* to myservlet.

The Request object will break this URL down like this:
requestURI = contextPath + servletPath + pathInfo

http://localhost:8080/webapp/MyServlet/23349 =
  /webapp  +  /MyServlet  + /23349


later.
Bill
--
William G. Thompson, Jr.
Chief Japple Evangelist | www.japple.org
Saucon Technologies
bthompson@saucontech.com | +1 908 947 7145 | www.saucontech.com


--
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