You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Larry Isaacs <La...@sas.com> on 2002/08/27 16:19:02 UTC
RE: Modifying Tomcat to have WEB-INF/config in Classpath
Hi,
Since there is a thread for this here on tomcat-user, I'm
replying here instead of tomcat-dev.
I think you would save yourself a lot of trouble if
you settled for putting db.properties in WEB-INF/classes/config
and used:
java.util.ResourceBundle.getBundle("config.db").getString("schema")
if you really don't want to use WEB-INF/classes directly. This
code would still work if you someday upgraded to Tomcat4 or beyond.
Cheers,
Larry
> -----Original Message-----
> From: Laurent Michenaud [mailto:lmichenaud@adeuza.fr]
> Sent: Tuesday, August 27, 2002 9:48 AM
> To: Tomcat Developers List
> Subject: RE: Modifying Tomcat to have WEB-INF/config in Classpath
>
>
> Because i read the properties in a interface like this :
>
> package com.a2a.util ;
> public interface A2aConstantes
> {
> public static final String SCHEMA =
> java.util.ResourceBundle.getBundle("db").getString("schema");
> }
>
> I don't think i can read the property file as u do because
> i can't do a getResourceAsStream()
>
> > -----Message d'origine-----
> > De : Larry Isaacs [mailto:Larry.Isaacs@sas.com]
> > Envoyé : mardi 27 août 2002 15:00
> > À : Tomcat Developers List
> > Objet : RE: Modifying Tomcat to have WEB-INF/config in Classpath
> >
> >
> > It is not clear why adding WEB-INF/config to the webapp
> > classpath is necessary or why you would even want to.
> > If you are simply trying to read a properties file:
> >
> > <%
> > java.util.Properties props = new java.util.Properties();
> > props.load(application.getResourceAsStream(
> > "/WEB-INF/config/myprops.properties"));
> > out.println(props);
> > %>
> >
> > works for me as a JSP test case.
> >
> > Cheers,
> > Larry
> >
> > > -----Original Message-----
> > > From: Laurent Michenaud [mailto:lmichenaud@adeuza.fr]
> > > Sent: Tuesday, August 27, 2002 8:29 AM
> > > To: tomcat-dev@jakarta.apache.org
> > > Subject: Modifying Tomcat to have WEB-INF/config in Classpath
> > >
> > >
> > > Hi,
> > >
> > > I want Tomcat 3.3.1 to have WEB-INF/config in the classpath(
> > > like WEB-INF/classes ).
> > >
> > > I have modified the LoaderInteceptor11.java :
> > > In the method addContext, i have added :
> > >
> > > // Add "WEB-INF/config"
> > > File d = new File(base + "/WEB-INF/config");
> > > if( d.exists() ) {
> > > try {
> > > URL url=new URL( "file", null,
> > > d.getAbsolutePath().replace('\\','/') + "/" );
> > > context.addClassPath( url );
> > > } catch( MalformedURLException ex ) {
> > > }
> > > }
> > >
> > >
> > > I have recompiled Tomcat but it doesnot work.
> > > My properties in WEB-INF/config are still not found.
> > >
> > > Can anybody help me ?
> > > Michenaud Laurent
> > > - Adeuza -
> > > [ Développeur Web - Administrateur Réseau ]
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> > > For
> > > additional commands,
> > > e-mail: <ma...@jakarta.apache.org>
> > >
> > >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
>
> --
> To unsubscribe, e-mail:
> <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> For
> additional commands,
> e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>