Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 13371 invoked by uid 500); 26 Jun 2001 13:44:11 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 13092 invoked from network); 26 Jun 2001 13:44:08 -0000 Received: from unknown (HELO dominio?gestao.intra.cet.pt) (194.65.138.12) by h31.sny.collab.net with SMTP; 26 Jun 2001 13:44:08 -0000 Received: from ptinovacao.pt (10.44.20.12 [10.44.20.12]) by dominio_gestao.intra.cet.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id NTQ4XQ28; Tue, 26 Jun 2001 14:24:12 +0100 Message-ID: <3B388CE0.6010504@ptinovacao.pt> Date: Tue, 26 Jun 2001 14:23:44 +0100 From: Pedro Salazar User-Agent: Mozilla/5.0 (X11; U; Linux 2.2.18 i686; en-US; m18) Gecko/20010131 Netscape6/6.01 X-Accept-Language: en MIME-Version: 1.0 To: tomcat-user@jakarta.apache.org Subject: open xml/xsl files inside classpath Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Greetings, I have a servlet which read some properties (using the ResourceBundle) from a properties file in a package PT.teste.props where exists a relation like this: " fileA.xml = file1.xsl fileB.xml = file2.xsl ... " Of course getting the properties file is simple task because I just use the location in classpath, ex: rb=ResourceBundle.getBundle("PT.teste.props."+properties_file); But, now I would like to open both files, the xml and the xsl file, which are in a package PT.teste.xml. I tested using the absolute path to them, but is not very recommendable because tomorrow I probably will put it in another location or in another machine... " Source xmlSource = new javax.xml.transform.stream.StreamSource (new java.net.URL("file:///opt/jakarta-tomcat-3.2.1/webapps/servlet_teste/WEB-INF/classes/PT/teste/xml/fileA.xml").openStream()); Source xslSource = new javax.xml.transform.stream.StreamSource (new java.net.URL("file:///opt/jakarta-tomcat-3.2.1/webapps/servlet_teste/WEB-INF/classes/PT/teste/xml/file1.xsl").openStream()); " Is there a easy way to open a file in a classpath directly? Or at least a way where the path is relative to the web application? A not very recommendable way just to solve my problem is use a path in a properties file which I would read in the init() of servlet... but, I wouldn't like to do it! thanks, Pedro Salazar.