L
Lord0
Hi there,
I've got a servlet (running on Tomcat) which contains a method for listing
the contents of a given directory on the machine on which it is running:
// snip
File allFiles = new File(myPath); // Absolute path
String files[]=allFiles.list();
// snip
So we get an array containing Strings corresponding to all the files in a
named directory.
This works fine and does what I need it to do. However when I move the
servlet from my Windoze machine (dev environment) to my linux machine (live
environment) I run into difficulties because the file paths are obviously
different. I would like to do it in such a way that the servlet *does not
need to be edited*. I had thought of a couple of possible solutions but at
the moment they are pretty vague and therefore I am looking for suggestions
from you kindselves.
My early ideas:
1. Indicate, somehow, in the server.xml, a "root" path which I can access
from within the servlet, which on the Windoze and Linux box would have a
different value.
2. Use JNDI?
So anyway, your thoughts would be appreciated
Lord0
I've got a servlet (running on Tomcat) which contains a method for listing
the contents of a given directory on the machine on which it is running:
// snip
File allFiles = new File(myPath); // Absolute path
String files[]=allFiles.list();
// snip
So we get an array containing Strings corresponding to all the files in a
named directory.
This works fine and does what I need it to do. However when I move the
servlet from my Windoze machine (dev environment) to my linux machine (live
environment) I run into difficulties because the file paths are obviously
different. I would like to do it in such a way that the servlet *does not
need to be edited*. I had thought of a couple of possible solutions but at
the moment they are pretty vague and therefore I am looking for suggestions
from you kindselves.
My early ideas:
1. Indicate, somehow, in the server.xml, a "root" path which I can access
from within the servlet, which on the Windoze and Linux box would have a
different value.
2. Use JNDI?
So anyway, your thoughts would be appreciated
Lord0