Thanks, Tim.

I'd just found a page on the 2.5 spec saying it was on its way.

I think I'm going to just use ServletContext.getServletContextName() and
just remember to keep them in step myself - I guess it's only an issue
during development anyway, but it seemed like such an elegant solution.

Cheers
--
Stuart Wood


On 5/22/06, Tim Funk <[EMAIL PROTECTED]> wrote:

Your on the right track - the servlet 2.5 spec fixes this (but tomcat 6
isn't
out yet).

If I were in this predicament - I'd use a ServletContext init parameter.
They
can be overridden in the <Context> declaration.

-Tim

Stuart Wood wrote:
> I have a web application running under Tomcat 5.0, and I need to write
> some output to a file.
> This app doesn't have its servlet context hardcoded in anywhere, so I
> can deploy it with any name and not worry about missing some random bit
> of code anywhere, and I often deploy it with different names so the
> customers can compare 2 versions side by side.
>
> My problem is that I need to output to a log file within the
> application, and I'd like the logfile name to be the context name, so
> that I don't have to worry about 2 separate deployments inadvertently
> writing to the same file.
> I can get the context path from the first request that comes in, but
> until that point, I don't seem to be able to retrieve it from either
> the ServletContext or the ServletConfig...
> Am I missing something?
>
> I'm running in Tomcat, so I can hack it using some Tomcat-specific
> code, but I'd rather leave it as portable as possible. Anyone have any
> ideas?
> Cheers in advance

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
--
Stuart Wood

Reply via email to