tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger L. Costello" <coste...@mitre.org>
Subject [Offtopic] Setting the directory where IO occurs in a servlet?
Date Sun, 30 Jun 2002 13:02:08 GMT
Hi Folks,

I have a servlet, running in Tomcat 4.0.3, which reads in files and
writes files.  Currently it does the reading and writing to the folder
where Tomcat was started.  I would like to have control over where the
servlet reads and writes.

My plan for controlling where IO occurs is to incorporate into my
webapps web.xml file the location of where I want IO to occur:

    <servlet>
        <servlet-name>parts</servlet-name>
        <servlet-class>PartsDepotServlet</servlet-class>
        <init-param>
            <param-name>physicalFilePath</param-name>
           
<param-value>c:\tomcat\webapps\parts-depot\WEB-INF\files</param-value>
        </init-param>
    </servlet>

Then, in my servlet I will read in the path:

    physicalFilePath = getInitParameter("physicalFilePath");

At the point I would like to somehow express "from now on all IO done by
the servlet should go to the folder indicated by physicalFilePath".  Is
there some way to do that, either in the Java API or in the Servlet API?

Is this strategy that I am taking the best approach?  /Roger

P.S. I realize that this is not really the appropriate list for this
question.  What list do you recommend?


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message