You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by SB <st...@cyberspace.org> on 2002/08/01 13:06:30 UTC

dynamic urls


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?

thanks
--st

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: dynamic urls

Posted by "William G. Thompson, Jr." <wg...@tnt-web.com>.
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>