tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Miller <bruce.mil...@nist.gov>
Subject Resource vs. RealPath
Date Sat, 06 May 2006 13:38:54 GMT
Hi Tomcatters;
  A seemingly naive question:
I've got various configuration data, tucked away
under /WEB-INF/.

If I use context.getRealPath(datapath), I can check the
timestamp, so that I know if it needs to be re-read.
However, this fails if we're serving from a .war file
(in which case, presumably it won't need re-reading?)

OTOH, context.getResourceAsStream(datapath) gives no
means to check the timestamp, but will work from .war.

An obvious solution is to use getRealPath to check the
timestamp and getResourceAsStream to read it.
But this seems to mix modes of thinking (A Resource being
something more abstract?).  Experience tells me this
can often lead to problems down the line...

So the question is: Am I missing something?
Is there some other Best Practices approach to this
rather simple situation?

Thanks in advance;
-- 
bruce.miller@nist.gov
http://math.nist.gov/~BMiller/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message