db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendle...@amberpoint.com>
Subject Re: Problem with Policy file examples (codeBase specification)?
Date Sat, 15 Jul 2006 15:43:38 GMT
>  SYNTAX:   grant codeBase "file:d:/derby/lib/-"
>   SYNTAX:    grant codeBase "file://f:/derby/lib/derby.jar"

Ah, the bizarre and sad world of file scheme URLs. Dress in warm
clothes and take lots of water if you want to pursue the path of
knowledge in this area :)

All kidding aside, file scheme URLs are a real mess. The official
standards (RFC 1738, in particular) never nailed these down, and
so lots of different syntax exists and is accepted in various
areas. It is incredibly hard to write file scheme URLs which work
everywhere, so you may just have to settle for getting URLs which
are good enough.

That being said, I think the form with double slashes is the most
acceptable, because these *are* URLs and URLs ought to have double
slashes. The fact that other syntax works is an accident of history.

And I think that the syntax for a Windows file scheme URL which is
generally considered to be the 'preferred' syntax nowadays is to
use *three* slashes before the drive letter, and then to replace the
colon with a vertical bar, which is because a colon is a reserved
character in an URL. So something like the following might be right:

   SYNTAX: grant codeBase "file:///f|/derby/lib/derby.jar"

However, the Sun documentation at
http://java.sun.com/j2se/1.4.2/docs/guide/security/PolicyFiles.html
says:

     Note: a codeBase value is a URL and thus should always utilize slashes
     (never backslashes) as the directory separator, even when the code
     source is actually on a Win32 system. Thus, if the source location
     for code on a Win32 system is actually C:\somepath\api\, then the
     policy codeBase entry should look like:

       grant codeBase "file:/C:/somepath/api/" {
           ...
       }

So at some point it becomes less important to decide what's *correct*
and more important to know, in practice, what syntax reliably works.

I fear you will have to conduct multiple experiments.

Here's some good references to learn more:

http://www.cs.tut.fi/~jkorpela/fileurl.html
http://blogs.msdn.com/freeassociations/archive/2005/05/19/420059.aspx
http://svnbook.red-bean.com/en/1.0/ch02s03.html#svn-ch-2-sidebar-1
http://www.ietf.org/rfc/rfc1738.txt

Hope this helps,

bryan


Mime
View raw message