> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Wolfgang Werner
> Sent: Friday, September 01, 2000 9:36 AM
> To: jBoss Developer
> Subject: [jBoss-Dev] [PATCH] Entity Resolver to remove access to sun
>
>
> Hello!
>
> some days ago I sent a patch concerning the behavior of the
> XmlFileReader. Please, could someone respond to this?
>
> a) is this not a problem?
> b) is this the wrong list?
> c) is a patch not welcome?
:)
of course the pathes are welcome, if it got lost in the noise please re post
it on this list,
regards
marc
>
> <grin/> Ok, to make it short, can please someone drop a short
> line, just to encourage me to keep on working?
>
> Thanks,
>
> Wolfgang
>
>
> >
> > Hello,
> >
> > I'm new to this list, so sorry if this has been discussed earlier.
> >
> > We are developing a large application on an comercial EJB server.
> > To broaden
> > our
> > vision, I 'ported' our app to jboss. As we are only using J2EE standard
> > stuff,
> > this was fast and easy.
> >
> > Great work! Congratulation to all!
> >
> > Due to the fact that we are sitting behind a firewall, I first
> ran into a
> > problem.
> > Everytime a EJB is (hot) deployed, the system is accessing the
> > EJB 1.1 spec
> > from
> > the original location (as specified in the EJB - xml file.
> >
> > Attached is a patch which introduces an Entity Resolver to the
> SAX parser.
> > Just
> > put the DTD in your classpath and the access will be ommitted.
> >
> > Glad to help, please comment.
> >
> > Greetinx,
> >
> > Wolfgang Wermer
> >
> > -------------------------------- snip -------------------------------
> > Index: XmlFileLoader.java
> > ===================================================================
> > RCS file:
> > /products/cvs/ejboss/jboss/src/main/org/jboss/metadata/XmlFileLoad
> > er.java,v
> > retrieving revision 1.3
> > diff -u -r1.3 XmlFileLoader.java
> > --- XmlFileLoader.java 2000/08/18 03:21:06 1.3
> > +++ XmlFileLoader.java 2000/08/28 05:30:06
> > @@ -11,12 +11,18 @@
> > import java.io.Reader;
> > import java.io.InputStreamReader;
> >
> > +import java.io.File;
> > +import java.io.InputStream;
> > +import java.io.FileInputStream;
> > +import java.util.Hashtable;
> > +
> > import org.w3c.dom.Document;
> > import org.w3c.dom.Element;
> >
> > import org.xml.sax.Parser;
> > import org.xml.sax.InputSource;
> > import org.xml.sax.SAXException;
> > +import org.xml.sax.EntityResolver;
> >
> > import org.jboss.ejb.DeploymentException;
> > import org.jboss.logging.Logger;
> > @@ -29,8 +35,47 @@
> > * @version $Revision: 1.3 $
> > */
> > public class XmlFileLoader {
> > - // Constants
> -----------------------------------------------------
> >
> > + /**
> > + * Local entity resolver to handle EJB 1.1 DTD. With this a http
> > connection
> > + * to sun is not needed during deployment.
> > + * @author <a href="mailto:[EMAIL PROTECTED]">Wolfgang
> Werner</a>
> > + **/
> > + private class LocalResolver implements EntityResolver {
> > +
> > + private Hashtable dtds = new Hashtable();
> > +
> > + public LocalResolver() {
> > + registerDTD(
> > + "-//Sun Microsystems, Inc.//DTD
> > Enterprise JavaBeans 1.1//EN",
> > + "ejb-jar.dtd");
> > + }
> > +
> > + public void registerDTD(String publicId, String
> > dtdFileName) {
> > + dtds.put(publicId, dtdFileName);
> > + }
> > +
> > + public InputSource resolveEntity (String publicId, String systemId)
> > + {
> > + String
> > + dtd = (String)dtds.get(publicId);
> > +
> > + if (dtd != null) {
> > + try {
> > + InputStream
> > + dtdStream =
> > XmlFileLoader.class.getClassLoader().getResourceAsStream(dtd);
> > + return new InputSource(dtdStream);
> > + } catch( Exception ex ) {
> > + // ignore
> > + }
> > + }
> > +
> > + return null;
> > + }
> > + }
> > +
> > + // Constants -----------------------------------------------------
> > +
> > // Attributes
> ----------------------------------------------------
> > ClassLoader classLoader;
> >
> > @@ -122,6 +167,10 @@
> > Parser parser = new com.sun.xml.parser.Parser();
> > xdb.setParser(parser);
> >
> > + // Use a local entity resolver to get rid of the
> > DTD loading via internet
> > + EntityResolver er = new LocalResolver();
> > + parser.setEntityResolver(er);
> > +
> > try {
> > parser.parse(new InputSource(in));
> > return xdb.getDocument();
> > -------------------------------- snap ----------------------------------
> >
> >
>
>
>