Hi,

First my configuration:  Ubuntu 9.10 Desktop, Tomcat 6.0.20.

I have a Java servlet (MyServlet) and from within that servlet I need to access 
a directory containing data files.  The Tomcat directory structure is like this:

tomcat
    webapps
        MyServlet
    DataFiles
        data1.xml
        data2.xml

On reading through various posts, I'm somewhat confused as to the best way (or 
any way, best, secure or otherwise) to access my data XML files via my servlet.

One method I have found is to define a context.xml file under the servlet's 
META-INF directory and within specify (somehow) the path of the DataFiles 
directory.  Something such as:  

    <Context path="../DataFiles" docBase=""  />

In this case, does this also allow access from any HTTP user?  Basically I just 
want the servlet to read/write to this directory and not anyone/anything else.  
I've not manage to get this going, so I'm not sure if Context Path is the right 
solution for what I'm trying to achieve.

The second method I've found is to add a grant line to catalina.policy file.  
Is this the right way to go?

Surely there is a way to access a directory outside of the webapps directory 
(as I don't want to place the DataFiles directory into the MyServlet directory 
- want to keep code and data separate).

Many thanks in advance!


Cheers,

Bernard.
                                          
_________________________________________________________________
Browse profiles for FREE! Meet local singles online.
http://clk.atdmt.com/NMN/go/150855801/direct/01/

Reply via email to