DTD files
Hi All,
This isn't really a Linux related question, but I thought I'd ask it anyway, since this will be probably very basic for most people. I just had a colleague coming up to me saying that there Tomcat application won't start because it has no internet connectivity. The Tomcat server is unable to retrieve the dtd files from java.sun.com. As far as I know, the DOCTYPE specifiers (example below) are only being used to identify which type of document the parser is working with, rather than for validation purposes. Quote:
However, if somebody could confirm this, then I can rest assured :) Thanks |
Hi -
You're correct - Tomcat is *not* trying to fetch stuff from Internet just because of the DOCTYPE definition. Your colleague is mistaken. "http://java.sun.com/dtd/web-app_2_3.dtd" is a "URN" (Universal Resource Name). It's only purpose is to provide a unique namespace, *not* to actually fetch something from the Internet. The details are in RFC 3151: http://www.faqs.org/rfcs/rfc3151.html |
Thank you very much
|
UPDATE:
It actually seems that it's only partially true. The parser tries to validate the document using the doctype specification. The thing is that it first tries to look for the dtd in the jar using the DTD name. If this fails, then the dtd is fetched from the URL. Quote:
I was able to reproduce this by altering the DTD name to something bogus, i.e. //SunZZZZ MicrosystemsZZZ, Inc.//DTD Web Application 2.3// My packet sniffer showed me that the it connected to the sun website. If anybody has a better understanding of this and would like to share it..feel free to do so. |
If the basic problem is about running a tomcat a tomcat application without worldwide connection, than the practical approach would be to copy the DTD to the local PC and modify/or to modify the DOCTYPE url.
This DOCTYPE behaviour is actually not specific to tomcat - it's the same behaviour as with all SGML-based marked-up contents (HTML, XML, etc): if a DOCTYPE needs to defined, then use one that can be accessed. This problem doesn't show up for HTML documents, because all sane browsers will have a default DOCTYPE setting if the HTML doesn't provide one, and that default is either part of the browser code or it is installed along with it. So you never have this problem during offline browsing. It seems that tomcat doesn't declare anything as default on it's own, but rather tries to access any DTD at the given url. |
All times are GMT -5. The time now is 04:44 PM. |