开发者

Has Sun deprecated Java DTD URLs?

We use the xmltask ANT task for conditional logic (ie: if statements) in our ANT scripts.

Currently this task is bombing, apparently because can't reach "http://java.sun.com/dtd/application_1_3.dtd". We can't access this URL either in our browser. Has Sun "deprecated" these Java DTD URL's?


Update: Appears http://java.sun.com/ is not available either. Not sure if this is a outage on Sun/Oracle's end or if 开发者_如何学运维this site has been decommissioned.

Update 2: Ok, now it is working. Hasn't been working since yesterday - I swear! I think @Jeremy is right we need to host this ourselves.


I suggest you just download it and host it yourself.

http://java.sun.com/dtd/


It's not being deprecated. It's a temporary issue, according to this thread.

Anyway, depending on externally hosted DTDs is a bad idea anyway and should be avoided.

Since the URIs are used as identifier, changing them isn't trivial, sometimes. However every XML parser should have an option to customize how DTDs (or Schemas) are loaded and it should be possible to use a local copy instead of the remote one. Additionally this would reduce the need for external connectivity and would speed up loading the XML.


Being able to build stuff without having network access is kind of nice. Here's an example of self-hosted DTDs and xmltask, for posterity.

Somewhere near the top of the build file (${ext.dir} being a local file path):

<xmlcatalog id="commonDTDs">
    <dtd publicId="-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" location="${ext.dir}/dtd/web-app_2_3.dtd" />
    <dtd publicId="-//tuckey.org//DTD UrlRewrite 3.2//EN" location="${ext.dir}/dtd/urlrewrite3.2.dtd" />
</xmlcatalog>

reference it later using xmlcatalog refId:

<xmltask source="${war.dir}/WEB-INF/web.xml" dest="${war.dir}/WEB-INF/web.xml">
    <xmlcatalog refId="commonDTDs" />
    <remove path="web-app/servlet[servlet-class/text()='loader.servlet.FileServlet']" />
    <remove path="web-app/servlet-mapping[servlet-name/text()='FileServlet']" />
</xmltask>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜