cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: Proposal: URL Protocols
Date Wed, 31 Jan 2001 12:06:03 GMT
Donald Ball wrote:
> 
> On Tue, 30 Jan 2001, Berin Loritsch wrote:
> 
> > Paul Russell wrote:
> > >
> > > * Berin Loritsch (bloritsch@apache.org) wrote :
> > > > I want to run something by the list regarding the way
> > > > Cocoon uses URLs to get references to files and such.
> > > > This _does_ affect both versions, and it refers to the
> > > > naming of the protocols.  The way Servlet 2.2+ specifies
> > > > to get files from the WAR file is the context.getResource()
> > > > method.  All resources are relative to the context root.
> > > > This is separate and distinct from Classloader Resources.
> > > > My proposal is to specify the following Resource protocols:
> > > > "resource:" This gets a ClassLoader resource, loaded by
> > > >             the Cocoon ClassLoader.  This is what it already
> > > >             does.
> > > > "context:"  This gets a Context resource, pulled by the
> > > >             Context.getResource() method.
> > >
> > > Yep. Works for me. +1. How do you propose implementing this? Using the
> > > standard URI api I assume?
> >
> > That would be the long term plan.  The alternative would be to do
> > what is already done in the NetUtils class.  Anyone have experience
> > creating URL Handlers?
> 
> i'm +1 as well, but warning - there's a serious problem with the URL
> handler implementation in the JDK. i can't remember the exact details, but
> maybe stefano will - it had something to do with problems arising if
> another package in the same JVM tried to register any URL handlers.

Yes, some code can specify a URLHandlerFactory only once per JVM. No
problem for applications, but for servlets, there is a high chance that:

1) the servlet engine has already installed one (happens with WebLogic,
for example)
2) another servlet has already installed one (happens for ISP who have
different cocoon instances on different virtual hosts)

So, using the 'new URL()' method is highly discouradged. 

I think the best solution would be to have something like a URL package
for Avalon that doesn't have these limitations and provides a way to
register more than one URLHandler into a singleton factory. But it's not
trivial and didn't have time to go in that direction.

> > Ability to use the loaded ClassPath (no more parsing of the classpath
> > attributes), ability to use streams (java input stream, and class
> > output stream).
> >
> > That way we won't need the repository at all (except for debugging
> > purposes)--as we can directly serialize the XSP java stream into
> > the compiler and directly load the class by stream into the
> > classloader.
> 
> oooh. sexy.

No, you can't do that. All java compilers in existance work on files,
not streams. Pier and I proposed a rough JSR for the java community
process to fix this and create "Java API for compilation" but that went
nowhere.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------


Mime
View raw message