cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: [C2] Merging pipelines into a new pipeline
Date Wed, 20 Sep 2000 23:27:22 GMT
Giacomo Pati wrote:
> 
> --- Paul Russell <paul@luminas.co.uk> wrote:
> > On Tue, Sep 19, 2000 at 08:03:08AM -0700, Giacomo Pati wrote:
> > > There is another way doing it:
> > >
> > >    URL url = new URL (null, "cvs://server/project/folder#version",
> > >                             new MyURLStreamHandlerFactoryImpl());
> > >
> > > But this requires you to sign your code and have a
> > > java.net.NetPermission named specifyStreamHandler granted to the
> > > calling context in the java.policy file, as I have understand it.
> >
> > Ahh! that might be better than reimplementing stuff. Do we need
> > that even with the default security manager? Might be worth
> > investigating. Shoudl we be using this instead of the resource:
> > hack currently in C2?
> 
> Do we have a "resource:" hack in C2 ?? Can't remember it!

IOUtil.java

  /**
   * Create a URL from a location. This method supports the
   * <i>resource://</i> pseudo-protocol for loading resources
   * accessible to this same class' <code>ClassLoader</code>
   *
   * @param location The location
   * @return The URL pointed to by the location
   * @exception MalformedURLException If the location is malformed
   */
  public static URL getURL(String location) throws MalformedURLException
{
    if (location.indexOf("://") < 0) {
      return (new File(location)).toURL();
    } else if (location.startsWith("resource://")) {
      URL u =
ClassUtils.getClassLoader().getResource(location.substring("resource://".length()));
      if (u != null) return u;
      else throw new RuntimeException(location + " could not be found.
(possible classloader problem)");
    } else {
      return new URL(location);
    }
  }

which is not that bad, but not as elegant as

  URL url = new URL("resource:/path/something");

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message