You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Donald Ball <ba...@webslingerZ.com> on 2000/05/09 18:23:59 UTC
RE: extension questions (fwd)
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" <da...@thinklinkinc.com>
Reply-To: xalan-dev@xml.apache.org
To: "'xalan-dev@xml.apache.org'" <xa...@xml.apache.org>
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.
http://www.javasoft.com/products/jdk/1.2/docs/api/java/net/URL.html#URL(java
.lang.String, java.lang.String, int, java.lang.String,
java.net.URLStreamHandler)
-----Original Message-----
From: Keith Visco [mailto:kvisco@exoffice.com]
Sent: Monday, May 08, 2000 7:03 PM
To: xalan-dev@xml.apache.org
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
spec.
--Keith
Jeff Cutler-Stamm wrote:
>
> i'm not garaunteed to have a URL. my document is the result of some
internal
> 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
table
> 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
> >
Re: extension questions (fwd)
Posted by Stefano Mazzocchi <st...@apache.org>.
Donald Ball wrote:
>
> I didn't know this. This could have been an alternate solution to the
> cocoon:, sbk:, repository: URL factory mess.
I knew about this feature, but a system property cannot be updated from
inside the JVM, but needs to be called from the outside, thus providing
another point of failure for the installation procedure.
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------