tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cox, Charlie" <c...@cincom.com>
Subject RE: REPOST: Please HELP!: URL Mapping Problems in servlet
Date Wed, 27 Feb 2002 18:44:01 GMT


> -----Original Message-----
> From: Mark B. Indictor [mailto:mbi@fiddler.com]
> Sent: Wednesday, February 27, 2002 1:17 PM
> To: 'Tomcat Users List'
> Subject: RE: REPOST: Please HELP!: URL Mapping Problems in servlet
> 
> 
> If the URL is: http://hostname/context/servlet/xxx
> 
> Then:
> 
> req.getPathInfo() returns:	/xxx
> req.getRequestURI() returns:	/context/servlet/xxx
> req.getServletPath() returns:	/servlet
> 
> How do I get just: /context/servlet

I don't think there is a function to get the full request path without the
final page/servlet name. 

This should get what you need:
req.getRequestURI().substring(0,req.getRequestURI().lastIndexOf("/"))

> 
> OR
> 
> How do I get Apache or Tomcat to respond to: 
> http://hostname/servlet/xxx?
> 

tomcat will already take a servlet named 'xxx' in this format unless you
disabled the default servlet invoker in conf\web.xml. You will have to map
/servlet/* to tomcat from apache.

Charlie


> Thanks
> 
>     - mbi
> ======================================================
> Mark Indictor -- Site2 Corporation
> mbi@site2.com
> <http://www.site2.com>
> Phone:(310)451-3472 FAX:(240)220-6341
> http://keyserver.pgp.com/pks/lookup?op=get&search=0x8959F966
> ====================================================== 
> 

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message