tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark B. Indictor" <...@fiddler.com>
Subject RE: REPOST: Please HELP!: URL Mapping Problems in servlet
Date Wed, 27 Feb 2002 19:03:06 GMT
I appreciate the help, but this still does not solve my problem.

You see, I need to handle URLs of the following forms:

http://hostname/context/servlet/xxx

as well as:

http://hostname/context/servlet


With your suggestion, I would be truncating these to:

http://hostname/context/servlet

and

http://hostname/context

Respectively. 

The first behavior is desirable, the second is not!

What I do not understand is why Apache and Tomcat conspire hide the
'context' element of the URL. I either need to find a way to isolate and
retrieve the full path to the servlet (/context/servlet) or I need to find a
way to set up Apache and Tomcat to recognize a URL that does not contain a
context component (/servlet).

Why does getServletPath() not return the whole path to the servlet,
including its context, if this information is, in fact, required to access
the servlet with a URL!?

Any suggestions?

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





-----Original Message-----
From: Cox, Charlie [mailto:ccox@cincom.com] 
Sent: Wednesday, February 27, 2002 10:44 AM
To: 'Tomcat Users List'
Subject: RE: REPOST: Please HELP!: URL Mapping Problems in 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("/"))

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message