Changeset 10087 for trunk/gsdl3/src
- Timestamp:
- 2005-06-14T11:09:41+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSEntityResolver.java
r8078 r10087 8 8 9 9 // uses a class loader to find entities 10 // The class loader to use can be set by setClassLoader(), otherwise it will use the class loader that loaded itself. For the Tomcat webapp, this will be the webapp class loader, not the system class loader. the webapp classloader knows about the classes in the WEB-INF/classes dir, the system classloader knows about the ones on the classpath. The system class loader is a parent to web app classloader, so this will be used as well. 11 10 12 public class GSEntityResolver implements EntityResolver { 11 13 14 ClassLoader class_loader = null; 15 16 public void setClassLoader(ClassLoader loader) { 17 this.class_loader = loader; 18 } 19 12 20 public InputSource resolveEntity (String public_id, String system_id) { 13 21 … … 26 34 } 27 35 } 28 29 //System.out.println("using class loader for "+temp_id); 30 URL url = ClassLoader.getSystemResource(temp_id); 36 // try using a class loader 37 if (this.class_loader==null) { 38 this.class_loader = this.getClass().getClassLoader(); 39 } 40 URL url = class_loader.getResource(temp_id); 31 41 if (url == null) { 32 //System.out.println("class loader didn't find it");33 42 return null; 34 43 } 35 44 return new InputSource("file://"+url.getFile()); 36 45 } 37 38 46 }
Note:
See TracChangeset
for help on using the changeset viewer.