tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deacon Marcus" <deacon_mar...@wwtech.pl>
Subject RE: get Servlet Context Name
Date Tue, 02 Oct 2001 02:17:05 GMT
Hi,
Depends on what exactly you need. You could use .getRealPath("/") to get a
String like "/tomcat/webapps/my-web-app/", then you can parse it to isolate
the "my-web-app" part.
Personally, I use a Filter (but load-on-webapp-init Servlet will do) that
takes a parameter like "webapp=webapp.com" and stores it in application
(ServletContext) scope so it's available to any Servlet/JSP.

Greetings, deacon Marcus

> -----Original Message-----
> From: chiuming [mailto:chiu01us@yahoo.com]
> Sent: Tuesday, October 02, 2001 3:19 AM
> To: tomcat-user@jakarta.apache.org
> Subject: get Servlet Context Name
>
>
> hi,
> any way I can get a servlet context ( web application
> )'s name with in a servlet?  on Servlet API 2.2 (not
> Servlet 2.3)
>
> -OR- there is no way to do that?
>
> P.S. I am using tomcat... may I access internal tomcat
> object to achieve that?
>
> thanks
>
> __________________________________________________
> Do You Yahoo!?
> Listen to your Yahoo! Mail messages from any phone.
> http://phone.yahoo.com


Mime
View raw message