tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris McNeilly" <cmcnei...@smartbrief.com>
Subject RE: Servlets and relative paths
Date Wed, 30 May 2001 18:22:11 GMT
No, my problem is that I can use this method to read the xsl file just
fine.  It's the includes inside the xsl file that aren't working.

For example, inside the xsl file (which I read into the servlet using
your pointer from the earlier email) there is the line

<xsl:include href='sections.xsl'/>

and I get an error saying that it cannot find file
tomcat/bin/sections.xsl.  Which, of course, it cannot, since the file is
located in Meta-Inf/.

Chris

> -----Original Message-----
> From: Bo Xu [mailto:bo@cybershop.ca]
> Sent: Wednesday, May 30, 2001 10:45 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: Servlets and relative paths
>
>
> Chris McNeilly wrote:
>
> > Thanks Bo.  This is certainly a step in the right direction.
> >
> > I can now include the xml file and xsl file using relative
> paths.  My
> > only problem now is that there are xsl includes inside the
> xsl files and
> > they are still being loaded incorrectly (using the
> tomcat/bin directory
> > as root, not the servlet context).  Any ideas?
> >
> > Thanks,
> >
> > Chris
> >
> > > Chris McNeilly wrote:
> > >
> > >  > I've got a servlet and am trying to open files.  The
> > > problem is that its
> > >  > defaulting to the tomcat/bin directory whenever I attempt
> > > to refer to
> > >  > them.  How can I change this?  Hardcoding the path isn't
> > > such a good
> > >  > idea as my dev environment is different from production.
> > > These are xml
> > >  > and xsl files and they are located on the webroot.
> > >  >
> > >  > Thanks,
> > >  >
> > >  > Chris
> > >
> > > Hi :-)  from several emails in Servlet-List and this List:
> > >
> > > * InputStream is = this.getServletContext().
> > >
> > > getResourceAsStream("/WEB-INF/testApp.properties");
> > >
> > > now testApp.properties is in myapp/WEB-INF/
> > >
> > >
> > > *
> > > - InputStream is =
> > > this.getClass().getResourceAsStream("testApp.properties");
> > > - InputStream is = Thread.currentThread().getContextClassLoader().
> > >
> getResourceAsStream("myservlet.conf");
> > >
> > >    now, (normally),  myservlet.conf/testApp.properties is in
> > > myapp/WEB-INF/classes
> > >
> > >
> > > Bo
> > > May.29, 2001
> > >
> > [...]
>
> Hello Chris :-)  I am not sure, do you want to  read a file in
> TOMCAT_HOME/bin?
> is the following possible?
>
> - put MyUtil.class in TOMCAT_HOME/bin
> - include TOMCAT_HOME/bin/MyUtil.class into CLASSPATH
> - put testApp.properties into TOMCAT_HOME/bin
> - in MyServlet, write the following code:
>   ...
>   MyUtil myobject=new MyUtil();
>   InputStream is =
>   myobject.getClass().getResourceAsStream("testApp.properties");
>   ...
>
> I don't test it,  if it is not right, please correct it, thanks! :-)
>
>
> Bo
> May.30, 2001
>
>
>
>


Mime
View raw message