Java: file (path) naming conventions

Currently, we are developing XSLT + Java servlets.
One question is on how to address a file (platform independent)?
What we tried (within XSL) is to address a file like that: file://///nameOfServer/.../... (with 5 slashes at the beginning).
That worked for MSIE and Firefox.

Now we address a file with the same naming convention as above and it will not work (dir.list(); = NULL).
Is there a naming convention that works on any platform (at least windows); file:///c:/temp doesn't work... And we tried many ;-)
go4javaAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
you should just need to take the protocol off the front of the url
and change first | to :

something like:

path = url.substring(8).replace('|', ':');
0
 
objectsCommented:
file:// is a URL, so you cannot use it to create a File instance.
If you need a File then use a regular path, if you need a URL use what you cuurently using
File also has a method toURL() to convert File name to URL

> file:///c:/temp doesn't work...

try:

file:///c|/temp doesn't work...
0
 
go4javaAuthor Commented:
We need a conversion rule from URL (file://///server/.../pdf/ => directory) to file naming, e.g. g:/.../pdf.
???
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
objectsCommented:
where is the url coming from?
and what do you need to do with the file?
0
 
go4javaAuthor Commented:
Well, actually the URL is a pre-defined path to all our web resources (htm, pdf...) and is been used within XSLT engine (to produce MSIE and Firefox compatible HTM pages).
We will run a batch process (Java + XSLT) to produce some 100 web pages (based on XML imput) and need to search files on our file server (by means of Java servlets). The result of such a search will be returned from Java servlet to XSL.
0
 
go4javaAuthor Commented:
objects, could you pls. explain your rule on the URL given above:

file://///server/.../pdf/
0
 
objectsCommented:
you'll need different transformations depending on whether it contains a |
theres no standard way to do it as the url may not even point to a file.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.