You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Brown <dw...@webitplanet.com> on 2002/12/09 12:45:12 UTC
Re: File structure in webapps for tomcat.
Simon Kelly writes:
> Hi,
>
> I am trying to get my servlet to write to and read from files within my
> webapp structure. However, when the servlet runs it seems that the working
> directory during its lifecycle is c:\xxx\tomcat 4.1. Is there any way, in
> web.xml, to force the servlet to run in it's own app directory structure?
>
> Regards
>
> Simon
>
>
> Institut fuer
> Prozessdatenverarbeitung
> und Elektronik,
> Forschungszentrum Karlsruhe GmbH,
> Postfach 3640,
> D-76021 Karlsruhe,
> Germany.
>
> Tel: (+49)/7247 82-4042
> E-mail : kelly@ipe.fzk.de
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
Hello Simon, servlets do run in their own webapp directory structure if
defined in their own web.xml and deploy w/ and expanded .war file. u have
not given enough info on what u have done in terms of deployment and what u
r planning to do as a project goal. thanx, david.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: File structure in webapps for tomcat.
Posted by Simon Kelly <ke...@ipe.fzk.de>.
Ah,
Ok. What I have is a standard war file structure deployed in the
c:\programme\apache group\tomcat 4.1\webapps directory, with the servlet
held in WEB-INF/Classes and the web.xml set up as follows.
<web-app>
<servlet>
<servlet-name>
main
</servlet-name>
<servlet-class>
FrontServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
main
</servlet-name>
<url-pattern>
/katrinmain
</url-pattern>
</servlet-mapping>
The war file is structure like this:
*.html (All my standard pages)
images/ (For all images I will be using)
queryfiles/ (These files are for searching a xml db and are the ones I am
trying to reference)
WEB-INF/ (Usual layout in here, with my servlets, libs, and extra classes)
Within the servlet I am running I need to open tempfiles, and open and read
the files within queryfiles/, it is this that I am having the problem with.
During the running of the servlet, I have done
File currentdir = File(".")
To get the current working directory (And as far as I know the directory the
servlet is running in) and then printted it to the screen. It is showing
that the current directory is c:\programme\apache group\tomcat 4.1\. Now,
if the servlet is running in its own directory I should see
c:\programme\apache group\tomcat 4.1\webapps\katrin\. but I don't. This is
where my problem comes as I need to access the files in c:\programme\apache
group\tomcat 4.1\webapps\katrin\queryfiles\ If the servlet current working
directory is tomcat, then I will need to tag the rest of the path onto the
end of the current working directory everytime. This will not make the
portable web app that I need.
Cheers
Simon
----- Original Message -----
From: "David Brown" <dw...@webitplanet.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, December 09, 2002 12:45 PM
Subject: Re: File structure in webapps for tomcat.
> Simon Kelly writes:
>
> > Hi,
> >
> > I am trying to get my servlet to write to and read from files within my
> > webapp structure. However, when the servlet runs it seems that the
working
> > directory during its lifecycle is c:\xxx\tomcat 4.1. Is there any way,
in
> > web.xml, to force the servlet to run in it's own app directory
structure?
> >
> > Regards
> >
> > Simon
> >
> >
> > Institut fuer
> > Prozessdatenverarbeitung
> > und Elektronik,
> > Forschungszentrum Karlsruhe GmbH,
> > Postfach 3640,
> > D-76021 Karlsruhe,
> > Germany.
> >
> > Tel: (+49)/7247 82-4042
> > E-mail : kelly@ipe.fzk.de
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
>
>
> Hello Simon, servlets do run in their own webapp directory structure if
> defined in their own web.xml and deploy w/ and expanded .war file. u have
> not given enough info on what u have done in terms of deployment and what
u
> r planning to do as a project goal. thanx, david.
>
>
> --
> To unsubscribe, e-mail:
<ma...@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>