1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.xml;
18
19 import java.io.*;
20
21 import org.apache.jetspeed.cache.disk.*;
22
23 import org.xml.sax.*;
24
25
26 /***
27 * an entity resolver which tries to lookup DTD files
28 * through the URL Manager.
29 *
30 * TODO: Should be a singleton.
31 *
32 *@author <A HREF="mailto:christian.sell@netcologne.de">Christian Sell</A>
33 *@author <A HREF="mailto:sgala@hisitech.com">Santiago Gala</A>
34 *@version $Id: JetspeedXMLEntityResolver.java,v 1.8 2004/02/23 03:14:43 jford Exp $
35 *
36 **/
37 public class JetspeedXMLEntityResolver implements EntityResolver
38 {
39 public InputSource resolveEntity (String publicId, String systemId)
40 {
41 try {
42
43 Reader rdr = JetspeedDiskCache.getInstance().
44 getEntry(systemId).getReader();
45 InputSource is = new InputSource(rdr);
46 is.setPublicId( publicId );
47 is.setSystemId( systemId );
48 return is;
49 } catch(IOException x)
50 {
51 System.err.println("JER: ( " + publicId +
52 " Taking " + systemId + " from cache throwed Exception: " + x);
53
54 }
55 return null;
56 }
57 }