cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <>
Subject RE: extension questions (fwd)
Date Tue, 09 May 2000 16:23:59 GMT
I didn't know this. This could have been an alternate solution to the
cocoon:, sbk:, repository: URL factory mess.

---------- Forwarded message ----------
Date: Tue, 9 May 2000 10:22:07 -0700 
From: "Sobeck, David" <>
To: "''" <>
Subject: RE: extension questions

You can do this without defining a servlet or running a web server/servlet
engine. Java supports the definition of new protocols. When a URL is opened,
a system property is examined for protocols which are not built in. If you
append yourPackage.yourProtocol to the java.protocol.handler.pkgs system
property (using a vertical bar as a separator), the JVM will look for a
conventionally named class extending URLStreamHandler, and you can define
this class to return a stream connected to an arbitrary data source.

In contrast to a servlet, any URL based on such a protocol will be
meaningless outside of the local JVM. On the other hand, it can be
convenient to have everything happening in the same thread (which is not the
case with a servlet).

Javasoft carefully hides the documentation of this feature under one of the
URL constructors. You would look in vain in the URLStreamHandler
documentation for any hint of how to make the JVM aware of a new Handler.
.lang.String, java.lang.String, int, java.lang.String,

-----Original Message-----
From: Keith Visco []
Sent: Monday, May 08, 2000 7:03 PM
Subject: Re: extension questions

You should put your Database code in a servlet if you can, which is
accessible via a URL call. This will allow you to continue to just use
the document() function and allow you to remain compatible with the XSLT


Jeff Cutler-Stamm wrote:
> i'm not garaunteed to have a URL. my document is the result of some
> processing which might involve accessing another URL or a database of some
> kind but my extension is the thing that actually needs to create the DOM.
> one method I tried was:
>  XSLTEngineImpl.setSourceDocument( "myFakeUrl", myDomTree );
> in my extension and then used document("myFakeUrl") in the stylesheet but
> that didn't seem to work (e.g. <xsl:apply-templates
> select="document('myFakeUrl')" /> returns nothing whereas if you give
> document() a file system path to an XML file it does work. The javadoc
> indicates that setSourceDocument() adds the Url->Document mapping to a
> so that the next time it is requested, that Document object is used rather
> than the Url being evaluated again but this doesn't seem to be working.
> regards,
> jeff
> >
> > You could just use the document() function if you just have a URL.
> >
> > --Keith
> >

View raw message