How can I access a file located in WEB-INF
Hi, I need to access a file located in the directory WEB-INF of my web application. In fact, in WEB-INF/conf. How can I open this file in one of my servlet ? Any advise is welcome. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I access a file located in WEB-INF
u can define path variable into web.xml file and u can call this path variable into ur servlet file. Deepak On Wed, 16 Jun 2004 STOCKHOLM,Raymond wrote : Hi, I need to access a file located in the directory WEB-INF of my web application. In fact, in WEB-INF/conf. How can I open this file in one of my servlet ? Any advise is welcome. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I access a file located in WEB-INF
FAQ http://jakarta.apache.org/tomcat/faq/misc.html#getResourceAsStream -Tim STOCKHOLM, Raymond wrote: Hi, I need to access a file located in the directory WEB-INF of my web application. In fact, in WEB-INF/conf. How can I open this file in one of my servlet ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How can I access a file located in WEB-INF
Thanks -Message d'origine- De : Tim Funk [mailto:[EMAIL PROTECTED] Envoyé : mercredi 16 juin 2004 13:24 À : Tomcat Users List Objet : Re: How can I access a file located in WEB-INF FAQ http://jakarta.apache.org/tomcat/faq/misc.html#getResourceAsStream -Tim STOCKHOLM, Raymond wrote: Hi, I need to access a file located in the directory WEB-INF of my web application. In fact, in WEB-INF/conf. How can I open this file in one of my servlet ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How can I access a file located in WEB-INF
File dir = new File(directoryName); String[] children = dir.list(); if (children == null) { // Either dir does not exist or is not a directory } else { for (int i=0; ichildren.length; i++) { // Get filename of file or directory String filename = children[i]; } } Tom Kochanowicz -Original Message- From: STOCKHOLM, Raymond [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:15 AM To: Tomcat Users List Subject: How can I access a file located in WEB-INF Hi, I need to access a file located in the directory WEB-INF of my web application. In fact, in WEB-INF/conf. How can I open this file in one of my servlet ? Any advise is welcome. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How can I access a file located in WEB-INF
Further, you will probably want to be able to construct the path to /WEB-INF at runtime rather than hardcoding paths... You can do that as follows: String fullPath = getServletContext().getRealPath(path); where path is a context-relative path (can include a filename if you want). For instance, I use this in a Struts plug-in to initialize a custom connection pool. The value I use for path is /WEB-INF/ConnPoolConfig.xml. The above gives you the full system path to the file (in my case, C:\tomcat\webapps\toa\WEB-INF on my development machine), so you can easily open it then. If you just use the above to get the path to a path (i.e., you want the fully-qualified path to WEB-INF in the current webapp, but not a specific file), you will need to append a file separator character at the end before appending a filename. Frank From: Tom K [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: How can I access a file located in WEB-INF Date: Wed, 16 Jun 2004 13:52:42 -0500 File dir = new File(directoryName); String[] children = dir.list(); if (children == null) { // Either dir does not exist or is not a directory } else { for (int i=0; ichildren.length; i++) { // Get filename of file or directory String filename = children[i]; } } Tom Kochanowicz -Original Message- From: STOCKHOLM, Raymond [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:15 AM To: Tomcat Users List Subject: How can I access a file located in WEB-INF Hi, I need to access a file located in the directory WEB-INF of my web application. In fact, in WEB-INF/conf. How can I open this file in one of my servlet ? Any advise is welcome. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 9 Dial-up Internet Access fights spam and pop-ups now 3 months FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How can I access a file located in WEB-INF
Hi, Just remember getRealPath returns null in a packed WAR file. Better approaches are in the tomcat FAQ. Yoav Shapira Millennium Research Informatics -Original Message- From: Frank Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 3:14 PM To: [EMAIL PROTECTED] Subject: RE: How can I access a file located in WEB-INF Further, you will probably want to be able to construct the path to /WEB- INF at runtime rather than hardcoding paths... You can do that as follows: String fullPath = getServletContext().getRealPath(path); where path is a context-relative path (can include a filename if you want). For instance, I use this in a Struts plug-in to initialize a custom connection pool. The value I use for path is /WEB- INF/ConnPoolConfig.xml. The above gives you the full system path to the file (in my case, C:\tomcat\webapps\toa\WEB-INF on my development machine), so you can easily open it then. If you just use the above to get the path to a path (i.e., you want the fully-qualified path to WEB-INF in the current webapp, but not a specific file), you will need to append a file separator character at the end before appending a filename. Frank From: Tom K [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: How can I access a file located in WEB-INF Date: Wed, 16 Jun 2004 13:52:42 -0500 File dir = new File(directoryName); String[] children = dir.list(); if (children == null) { // Either dir does not exist or is not a directory } else { for (int i=0; ichildren.length; i++) { // Get filename of file or directory String filename = children[i]; } } Tom Kochanowicz -Original Message- From: STOCKHOLM, Raymond [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:15 AM To: Tomcat Users List Subject: How can I access a file located in WEB-INF Hi, I need to access a file located in the directory WEB-INF of my web application. In fact, in WEB-INF/conf. How can I open this file in one of my servlet ? Any advise is welcome. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 9 Dial-up Internet Access fights spam and pop-ups - now 3 months FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How can I access a file located in WEB-INF
I suppose you could use a getRelativePath() -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:15 PM To: Tomcat Users List Subject: RE: How can I access a file located in WEB-INF Hi, Just remember getRealPath returns null in a packed WAR file. Better approaches are in the tomcat FAQ. Yoav Shapira Millennium Research Informatics -Original Message- From: Frank Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 3:14 PM To: [EMAIL PROTECTED] Subject: RE: How can I access a file located in WEB-INF Further, you will probably want to be able to construct the path to /WEB- INF at runtime rather than hardcoding paths... You can do that as follows: String fullPath = getServletContext().getRealPath(path); where path is a context-relative path (can include a filename if you want). For instance, I use this in a Struts plug-in to initialize a custom connection pool. The value I use for path is /WEB- INF/ConnPoolConfig.xml. The above gives you the full system path to the file (in my case, C:\tomcat\webapps\toa\WEB-INF on my development machine), so you can easily open it then. If you just use the above to get the path to a path (i.e., you want the fully-qualified path to WEB-INF in the current webapp, but not a specific file), you will need to append a file separator character at the end before appending a filename. Frank From: Tom K [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: How can I access a file located in WEB-INF Date: Wed, 16 Jun 2004 13:52:42 -0500 File dir = new File(directoryName); String[] children = dir.list(); if (children == null) { // Either dir does not exist or is not a directory } else { for (int i=0; ichildren.length; i++) { // Get filename of file or directory String filename = children[i]; } } Tom Kochanowicz -Original Message- From: STOCKHOLM, Raymond [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:15 AM To: Tomcat Users List Subject: How can I access a file located in WEB-INF Hi, I need to access a file located in the directory WEB-INF of my web application. In fact, in WEB-INF/conf. How can I open this file in one of my servlet ? Any advise is welcome. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 9 Dial-up Internet Access fights spam and pop-ups - now 3 months FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How can I access a file located in WEB-INF
Hi, I suppose you could use a getRelativePath() Huh? Yoav -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:15 PM To: Tomcat Users List Subject: RE: How can I access a file located in WEB-INF Hi, Just remember getRealPath returns null in a packed WAR file. Better approaches are in the tomcat FAQ. Yoav Shapira Millennium Research Informatics -Original Message- From: Frank Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 3:14 PM To: [EMAIL PROTECTED] Subject: RE: How can I access a file located in WEB-INF Further, you will probably want to be able to construct the path to /WEB- INF at runtime rather than hardcoding paths... You can do that as follows: String fullPath = getServletContext().getRealPath(path); where path is a context-relative path (can include a filename if you want). For instance, I use this in a Struts plug-in to initialize a custom connection pool. The value I use for path is /WEB- INF/ConnPoolConfig.xml. The above gives you the full system path to the file (in my case, C:\tomcat\webapps\toa\WEB-INF on my development machine), so you can easily open it then. If you just use the above to get the path to a path (i.e., you want the fully-qualified path to WEB-INF in the current webapp, but not a specific file), you will need to append a file separator character at the end before appending a filename. Frank From: Tom K [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: How can I access a file located in WEB-INF Date: Wed, 16 Jun 2004 13:52:42 -0500 File dir = new File(directoryName); String[] children = dir.list(); if (children == null) { // Either dir does not exist or is not a directory } else { for (int i=0; ichildren.length; i++) { // Get filename of file or directory String filename = children[i]; } } Tom Kochanowicz -Original Message- From: STOCKHOLM, Raymond [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:15 AM To: Tomcat Users List Subject: How can I access a file located in WEB-INF Hi, I need to access a file located in the directory WEB-INF of my web application. In fact, in WEB-INF/conf. How can I open this file in one of my servlet ? Any advise is welcome. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 9 Dial-up Internet Access fights spam and pop-ups - now 3 months FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify
RE: How can I access a file located in WEB-INF
I didn't know that, thanks for the heads-up! From: Shapira, Yoav [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: RE: How can I access a file located in WEB-INF Date: Wed, 16 Jun 2004 15:14:33 -0400 Hi, Just remember getRealPath returns null in a packed WAR file. Better approaches are in the tomcat FAQ. Yoav Shapira Millennium Research Informatics -Original Message- From: Frank Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 3:14 PM To: [EMAIL PROTECTED] Subject: RE: How can I access a file located in WEB-INF Further, you will probably want to be able to construct the path to /WEB- INF at runtime rather than hardcoding paths... You can do that as follows: String fullPath = getServletContext().getRealPath(path); where path is a context-relative path (can include a filename if you want). For instance, I use this in a Struts plug-in to initialize a custom connection pool. The value I use for path is /WEB- INF/ConnPoolConfig.xml. The above gives you the full system path to the file (in my case, C:\tomcat\webapps\toa\WEB-INF on my development machine), so you can easily open it then. If you just use the above to get the path to a path (i.e., you want the fully-qualified path to WEB-INF in the current webapp, but not a specific file), you will need to append a file separator character at the end before appending a filename. Frank From: Tom K [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Subject: RE: How can I access a file located in WEB-INF Date: Wed, 16 Jun 2004 13:52:42 -0500 File dir = new File(directoryName); String[] children = dir.list(); if (children == null) { // Either dir does not exist or is not a directory } else { for (int i=0; ichildren.length; i++) { // Get filename of file or directory String filename = children[i]; } } Tom Kochanowicz -Original Message- From: STOCKHOLM, Raymond [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:15 AM To: Tomcat Users List Subject: How can I access a file located in WEB-INF Hi, I need to access a file located in the directory WEB-INF of my web application. In fact, in WEB-INF/conf. How can I open this file in one of my servlet ? Any advise is welcome. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 9 Dial-up Internet Access fights spam and pop-ups - now 3 months FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Looking to buy a house? Get informed with the Home Buying Guide from MSN House Home. http://coldwellbanker.msn.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]