ServletContext.getContextPath() ?

Endre Stølsvik <[email protected]> Mon, 19 Jul 2004 12:46:42 +0200 (CEST)
Newsgroups gmane.comp.java.advanced-servlets
Message-ID <Pine.LNX.4.44.0407191237000.374-100000@excalibur.intra.coretrek.com>
I must be missing something..

Where can I find HttpServletRequest.getContextPath()-like information,
when only having the ServletContext?

See, when I start up the web application, I'd like to check for some
extra config-information based on what the web application is named.

In ServletContext's JavaDoc, it says:
  " There is one context per "web application" per Java Virtual Machine.
(A "web application" is a collection of servlets and content installed
under a specific subset of the server's URL namespace such as /catalog and
possibly installed via a .war file.) "

But I -can't- get to this information (the "/catalog" part) w/o having a
request to work from? I'm just wondering if I have lost half of my brain
this weekend, or if something else is missing..

  (I guess I in many circumstances could do some dirty trix with
context.getRealPath("foo") og getResource("foo"), and then parsing the
result for the context's name, but HEY this is really really bad, and not
what you'd want.)

thanks,
Endre



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

Before posting a question, try to find your answer here: 
<http://www.egroups.com/links/advanced-servlets>
Announcements should go to: [email protected]
To Post a message, send it to: [email protected]
To Unsubscribe, send a blank message to: [email protected] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/advanced-servlets/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/