Oops...that should be ServletContext.getResource() and
ServletContext.getResourceAsStream().

drumshamen

| -----Original Message-----
| From: A mailing list for discussion about Sun Microsystem's Java Servlet
| API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Jason
| Coward
| Sent: Friday, May 11, 2001 8:24 AM
| To: [EMAIL PROTECTED]
| Subject: Re: Question about file "reachablitiy"
|
|
| Endre:
|
| You asked:
| | Can I access (config) files which resides in the WEB-INF directory?
| |
| | I have some config files for a "server" I've made in Servlets, and I
| | basically wonder what the spec says about files in WEB-INF (not lib or
| | classes). I now have them residing in "classes", but I find this a bit
| | ugly. It would be cooler if I could put them along with the web.xml.
|
| Absolutely, check out the ServletContext.getRealPath(String
| path):String method
| in the 2.2 API docs.  This only works though if the WEB-INF directory is
| deployed to an actual physical location.  A warning though, some application
| servers do not extract the contents of .war files (I believe that
| WebLogic works
| in this manner) and so reading those files is possible only by using the
| following methods...
|
|  * ServletContent.getResource(String path):java.net.URL or
|  * getResourceAsStream(String path):java.io.InputStream
|
| However, this would only work in a read-only manner; in these cases,
| it might be
| better to create another physical location (maybe configured as an
| <init-param>
| in web.xml that points to a physical location you can count on being there for
| read/write access.  Again though, this is only an issue on certain servlet
| engines that support .war file deployment and do not extract the
| contents of the
| .war file to a physical location.
|
| Hope that helps, and someone please correct me if I'm wrong or my
| explanation is
| inaccurate.
|
|
| Thanks,
|
| drumshamen
|
| ___________________________________________________________________________
| To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
| of the message "signoff SERVLET-INTEREST".
|
| Archives: http://archives.java.sun.com/archives/servlet-interest.html
| Resources: http://java.sun.com/products/servlet/external-resources.html
| LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
|

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to