On Mon, 7 Jan 2002, DONNIE HALE wrote:

> Date: Mon, 07 Jan 2002 16:20:02 -0500
> From: DONNIE HALE <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: RE: Problem with file URL
>
> Not to belabor the point, but in the Java world we can't dismiss
> non-"network" (e.g. those which establish some sort of TCP/IP
> connection) as unimportant. Significant aspects of Java are now
> dependent upon java.net.URL objects and their corresponding URL
> handlers. For example, grants to codebases in .policy files are done via
> a "file:" URL.
>
> A good paper on this subject is:
>
> http://www.develop.com/downloads/java_protocol.pdf
>

As an example use case for this kind of thing, Tomcat 4 uses a private
"jndi:"  URL protocol (and provides the corresponding URLStreamHandler) to
gain access to the static resources of your web application.  You can see
this in action if you call ServletContext.getResource() on such a
resource, and print out the value of the returned URL as a String.  Yet,
if you call url.openStream() on this URL, you auto-magically get an
InputStream to this resource, without having to know anything about how
the container implements it (which might really be file I/O or reading a
JarEntry, depending on whether your webapp was unpacked or not).

There are some warts on the design of java.net.URL, but overall it is a
pretty impressive abstraction.

> FWIW...
>
> Donnie
>

Craig


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to