Hello all,

Any ideas as to how I can make an XML DTD/Schema available via a JNDI URL
within Tomcat?

I have a web application to deploy.  For simplicity, and to simplify
upgrades without worrying about new/modified/deleted files between versions,
I deploy it as a WAR file.

The application can import external XML documents, which must conform to a
specific DTD.  The DTD URL cannot be a "file:" URL, because it'll be
deployed in several places, on various platforms.  It cannot be a "http:"
URL pointing to a reference server, as the application won't always be able
to connect to the Internet (and because it's relatively slow); furthermore,
it cannot be a URL referring back to the server where the webapp is
deployed, because some references to XML files are required during the
"contextInitialized" event (for configuration)... webapp content, i.e.:
servlets, etc., aren't available until the event listener has  finished
running.

One idea I had was to declare the URL for the DTD as a JNDI URL for a
ServletContext ResourcePath; with Tomcat, this is implemented as a JNDI URL,
but I'm not sure if this is something that I can count on in all servlet
engines (the JNDI URL might differ, and the URL is not required to JNDI at
all if I understand well the Servlet API specs.).

However, the above idea did make me wonder if I could use JNDI explicitly
within server config/deployment descriptor to expose DTDs.  I had thought of
adding a reference to the DTD using a resource path URL into the JNDI
context at startup, before attempting to open any XML documents with a
corresponding JNDI URL, but I'm not sure about the feasibility of this.

Or am I better to implement my own simple JNDI service provider, in
*addition* to any service providers (such as Tomcat's...), to resolve
certain names, and retrieve corresponding documents?  It seems a bit
daunting, as I'm still a bit inexperienced with JNDI...

In any case, even if I could add a reference to the DTD using a JNDI URL,
I'm not sure what would happend when the XML parser attempts to open the
input stream on a connection to such a URL.  All I can see are references to
some very basic types, such as java.lang.String and object factories, for
configuring JNDI resources: I'm not sure if I could specify an InputStream,
a URL, or whatever here... :-(

Hopefully someone will find this an interesting subject to pick up on!

Thanks,
Chris B.



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to