On 05/03/2007, at 6:22 PM, Caldarale, Charles R wrote:

From: Paul A. Hoadley [mailto:[EMAIL PROTECTED]
Subject: Re: Using getImplementationVersion() to read MANIFEST.MF

I ended up doing something quite like this (though using
java.util.jar.Manifest)

Watch out for that - it won't work unless the app is deployed as a .war
on a device with a real file system.  The getResourceAsStream()
mechanism should work in all environments.

Oh, I just meant I used java.util.jar.Manifest to parse the manifest instead of java.util.Properties. I still used ServletContext.getResourceAsStream() to obtain it. Is that safe, or does it also suffer from that caveat?

<jsp:setProperty name="version" property="servletContext" value="$
{pageContext.servletContext}"/>

Is this the idiomatic way for a non-servlet object to obtain a
ServletContext, or am I overlooking something easier or more
appropriate?

Sounds o.k. to me, but others with more bean experience may have
alternatives.

I guess the question is this: is there another way for a non-servlet class instantiated within a servlet container to obtain a ServletContext object? (In several days of Googling, I've seen the question asked a few times, but not (that I recall) answered.)


--
Paul.

w  http://logicsquad.net/
h  http://paul.hoadley.name/



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to