Byron Estes<br />Sun Certified Enterprise Architect<br />Senior Consulant<br />Blackwell Consulting Services<br />Chicago, IL<br /><a href="http://www.bcsinc.com" target="_blank" rel="nofollow">www.bcsinc.com</a>
Originally posted by M Kozelek:
Ok, so are you saying that in using getRealPath(), I would always pass a string representing a single resource (e.g. "conf.xml instead of "config/conf.xml")? If that is the case, all of the resources would have to be stored in <<web-app>>/web, correct?
If I use the getResourceAsStream() and create a new File() from the result, and then use that file to create my XmlStore(), I should be golden, right? That method will give me access from a servlet to any file in the app or server file system (assuming proper rights).
Am I getting warmer?
Originally posted by M Kozelek:
I'm actually confused on your servlet. I'm not seeing how the image is streamed to the webpage unless that href is just inserting those bites as a image right then and there since it is a mapping to the servlet and the servlet just returns that stream. I like that approach, though. I'll have to mess around with that.
Please help bridge the gap here then. So I can get the file from behind WEB-INF as long as it is in bytes. However, I the JPreferences API creates the XML file store using the following methods:
Both of these are just string represenations of the path (which is the reason I was trying to use an real/absolute path).
So even if I get the buffered stream back, I'm not sure I can leverage it.
Feeling stuck...
Originally posted by balasg jothi:
Hi,
Add the following entry in Web.xml and restart the server
<env-entry id="EnvEntry_1">
<env-entry-name>ConfigFile</env-entry-name>
<env-entry-value>/export/home/bala/test.xml</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
and use the following code in ur servlet.
javax.naming.Context context = new javax.naming.InitialContext();
String initialConfigFile = (String) context.lookup ("java:comp/env/ConfigFile");
Thats it
Thanks
Bala L
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |