Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

RE: Retrieving the context path from a standalone class

Shapira, Yoav

2004-01-08

Replies:


Howdy,

>One way is by taking advantage of Tomcat's naming conventions with the
>tempdir....
>
>      String tempdir =
>       "" + context.getAttribute("javax.servlet.context.tempdir");
>      int lastSlash = tempdir.lastIndexOf(File.separator);
>
>      if ((tempdir.length() - 1) > lastSlash) {
>       logHomePropName = tempdir.substring(lastSlash + 1) +
>".log.home";
>      }

Very tomcat-specific and subject to change ;) But the 2nd approach is
much better, as I mentioned using ServletContext#getResource is a good
way to go. As I was reading the code, I could swear I'd seen it before,
and then I realized it's a paste from the log4j repository selector you
wrote ;) (BTW how come we haven't moved it from log4j-sandbox to log4j
for 1.3 yet?)

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.