-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Cris,

On 3/10/17 12:56 PM, Berneburg, Cris J. - US wrote:
> Chuck
> 
>>> How do you all configure the location of a special folder that
>>> is not part of the deployment package itself?  A site-specific
>>> config file perhaps?
>> 
>> Take a look at this: 
>> http://tomcat.apache.org/tomcat-8.5-doc/config/resources.html
>> 
>> A <Resources> element within <Context> allows specification of
>> areas outside of the Tomcat deployment that the webapp can access
>> via ServletContext .getResource() or getResourceAsStream().
> 
> Thanks for pointing that out.  Hmm...  It looks like 
> getResourceAsStream might work.  We use a library to processes the 
> files.  Currently we supply it with a java.io.File as an input 
> source, but the library also can accept a java.io.InputStream for 
> input too.

Don't forget to close the InputStream when you are done ;)

I see a ton of code like this:

configureFromPropertiesFile(app.getResourceAsStream("/config.file"))

I suspect the JVM does finally close all that junk up, but it's really
bad programming practice IMHO.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYwu8eAAoJEBzwKT+lPKRYxuEQAKdgNAu6UvD1MM7faL/BrIzX
VnYoBlpMwJ8wEWBRqtg7MrLkhzCFnhrtO/hhVxc2tAeliz2Pk7VlXMv34vlt/uCl
r/t+o4lPju9WsJaT1AmjkytBGLum9Ab5VBMbmsS/jtyiJ9iC/ghR0VbJJG6yB3B9
+Ycbfb9wodLXJ5UYzzNEuLBOndR3P1etw1OSRRxdG8g8eI3GPYM+L8NeqP7s9jhf
9up3PbT0k1GOo4Jhqo1bvzBoMEfVptQKn2E+QzrtaeYcMNPS7Slr79gWG8jBYEeV
cfIDxhQ1nIabmT4Rqke1K/Ek/duTRXXIuPj1QNVSr0uEgi3pgfaNgQCyhwjj32+l
U1PFOXeADoCh/ofzpGUoxnkXhXNXCNPFdjvmpjUwahB6x1YqgIPqOEZvIbuCiAnT
yPlBncszQlpurrsmR7AWvW28p8NhScjwYYeGG6VRfBhLKMLvTrnfSeQBNcq//vfn
wPSyVpn4zH28X2Mqe83VYCLXqXne5QPITffshOFYylUQPhikrSdLSgylCl6Cnoya
n/cqjCmJTVrOH+BBiIOtjYZWDCvodX6E95W+pUb4BOtrdp1a5A31L58RU3hiorqo
xv1ZbWWpUASNTQXJQFkJMGYNCU2aRbxgW6/65Tv6chgpF1pDa5xKN43ArVyhsoIu
y1uf4m+Q8hgeM8Fvv2XA
=gSr+
-----END PGP SIGNATURE-----

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

Reply via email to