[i'm going to cross-post my reply to the jsp and servlet
interest lists ... as i've been burned on this very item
in the past and am curious as to folks opinions].

hi joe -

!great information!

for a good part of the day i've been trying to resolve
a "portable file url specified docBase" issue. for what
it is worth and this may be a bit dated but i've used
the following format since jdk 1.0.x days with measurable
success:

        file://localhost/PATH

        where PATH can look like "foo/bar" for unix
                and "C|/foo/bar" (or something like this)
                on win

i've run into modo various jdk version/platform issues
when using file urls which are specified with anything
less then the above. that said, i'm really not sure how
to specify relative file urls with the above scheme in
a portable manner as the "third" slash designates the
the root file system ... or so i believe.

        eg: file:../foo.jar

i'd like to hear thoughts on this item as it is really
a bit of a pain in the a$$ when it comes to specifying
a reliable (ie jdk 1.1.x and jdk 1.2.x on win/solaris/*
for relative and absolute paths) file based docBase.

any ideas? i am optimistic (and stubborn) so i believe
there is a solution here.

thx much,

- james

-------- Original Message --------
Subject: Re:      Re: JSWDK 1.0 Feedback:
Date: Thu, 21 Oct 1999 23:20:05 -0400
From: "Joe Sam Shirah" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>


    Hi James,

    Must be some sort of cycle thing.  There have recently been separate
and
distinct queries regarding file URLs on the RMI and advanced java lists
as
well in the last few days.

    For what it may be worth to you, I'm sending some output data from
NT as
well as a suggestion I sent based on the RFC to Jen McGinn.

**************************
    I went back to the two programs I mentioned previously and ran them
under 1.1.8 and 1.2.2.  I changed the drive and directory name ( the
list
doesn't need to know my structures, ) but the rest is the exact output.
The
applet has a textfield in which it expects just a file name and displays
information.  The application expects everything as
'file:/adir/ur2.txt',
run from the root of the 'Z:' drive.

    Basically the applet shows the default behavior of 'file:/'  -- one
slash.  The application shows one, two and three slash behavior and that
the
intervening directory is basically lost when 'file://' -- two slashes
are
used.  Both also show differences between 1.1.8 and 1.2.2

    Again, I have code if anyone wants it.  And, I don't explain this
stuff,
I just report it.  Here goes:

applet defaults docbase, codebase and uses:

myURL = new URL( getCodeBase() + tfEntry.getText() );

results:
1.1.8

File name input ==> ur2.txt

CodeBase is file:/Z:/adir/.

DocBase is file:/Z:/adir/urlfilea.html.

myURL is file:/Z:/adir/ur2.txt.

myFile is /Z:/adir/ur2.txt.

Canonical: Z:\adir\ur2.txt

Absolute: /Z:/adir/ur2.txt

Path: /Z:/adir/ur2.txt



1.2.2 ( Only differences shown )

myFile is Z:\adir\ur2.txt.

Absolute: Z:\adir\ur2.txt

Path: Z:\adir\ur2.txt


========================================
========================================

application takes file: protocol through filename, uses

           myURL = new URL( argURL );
           myFile = new File( myURL.getFile() );

results:

1.1.8

args[0] is: file:/adir/ur2.txt
URL info:
file:/adir/ur2.txt         // myURL.toString()
/adir/ur2.txt              // myURL.getFile()
File info:
/adir/ur2.txt              // myFile.getAbsolutePath()
/adir/ur2.txt                // myFile.getPath()
Z:\adir\ur2.txt            // myFile.getCanonicalPath()


args[0] is: file://adir/ur2.txt
URL info:
file://adir/ur2.txt
/ur2.txt
File info:
/ur2.txt
/ur2.txt
Z:\ur2.txt


args[0] is: file:///adir/ur2.txt // same result as "file:/"


1.2.2    ( differences )

args[0] is: file:/adir/ur2.txt
URL info: // same

File info:
Z:\adir\ur2.txt
\adir\ur2.txt
Z:\adir\ur2.txt



args[0] is: file://adir/ur2.txt
URL info: // same

File info:
Z:\ur2.txt
\ur2.txt
Z:\ur2.txt


args[0] is: file:///adir/ur2.txt // same result as "file:/adir/ur2.txt"

**************************

>     Hi Jennifer,
>
>     Just wanted to follow through.  Given the following from RFC 1738,
> section 3.10:
> -------------------------------------------------
>
> A file URL takes the form:       file://<host>/<path>
>
> ...
>
> As a special case, <host> can be the string "localhost" or the empty
>    string; this is interpreted as `the machine from which the URL is
>    being interpreted'.
>
> -------------------------------------------------
>
>     It seems to me that the form most likely to be portable inside and
> outside of java is 'file:///' ( three slashes, ) which would be equivalent
> to 'file://<nothing>/'
>
>     Certainly intuitive.  Unfortunately, I know of at least two widespread
> examples, one in a prominent book, that use 'file:' with no slashes.
>

                                        Joe Sam


Joe Sam Shirah
Autumn Software
What you don't know DOES hurt you...and your business
___________________________________________

-----Original Message-----
From: James Todd <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, October 21, 1999 4:52 PM
Subject: Re: JSWDK 1.0 Feedback:


>[cross posting to interest lists in case others have run
>into the same issue]
>
>ahhh ... interesting. it looks like there might be a problem
>with specifying absolute docBase parameters on jdk 1.1.x/win
>which appears to be resolved by running on jdk 1.3.x and most
>likely on 1.2.x.
>
>file based urls on jdk1.1.x/win has been a vexing problem.
>looks like we may need to look at applying some of the patch
>logic to the docBase parameter as well.
>
>hope this helps,
>
>- james
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to