You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by Nick Lothian <ni...@essential.com.au> on 2004/11/24 05:37:17 UTC
Castor & network access
Currently it seems that Castor is retrieving
http://java.sun.com/dtd/web-app_2_3.dtd everytime Pluto starts up.
Is it possible to disable this?
Nick
Re: Castor & network access
Posted by Roger Ruttimann <ro...@apache.org>.
You have to use a local copy of the web-app_2_3.dtd.
This can be done by using using a custom EntityResolver class while
reading the XML file.
Something like:
<code_snip>
DocumentBuilder db = dbf.newDocumentBuilder();
// Use the local dtd instead of remote dtd. This
// allows to deploy the application offline
db.setEntityResolver(new EntityResolver()
{
public InputSource resolveEntity(java.lang.String
publicId, java.lang.String systemId)
throws SAXException, java.io.IOException
{
if
(systemId.equals("http://java.sun.com/dtd/web-app_2_3.dtd"))
{
return new
InputSource(getClass().getResourceAsStream("web-app_2_3.dtd"));
}
else
return null;
}
});
Document doc = db.parse(new File(webXml));
<code snip>
I hope it helps
Roger
Nick Lothian wrote:
>Currently it seems that Castor is retrieving
>http://java.sun.com/dtd/web-app_2_3.dtd everytime Pluto starts up.
>
>Is it possible to disable this?
>
>Nick
>
>
>