Author: mickw
Date: 2006-04-05 08:40:36 +0200 (Wed, 05 Apr 2006)
New Revision: 2709

Added:
   
trunk/src/java/no/schibstedsok/front/searchportal/configuration/loader/LocalEntityResolver.java
Log:
forgot to add to my last commit


Added: 
trunk/src/java/no/schibstedsok/front/searchportal/configuration/loader/LocalEntityResolver.java
===================================================================
--- 
trunk/src/java/no/schibstedsok/front/searchportal/configuration/loader/LocalEntityResolver.java
                             (rev 0)
+++ 
trunk/src/java/no/schibstedsok/front/searchportal/configuration/loader/LocalEntityResolver.java
     2006-04-05 06:40:36 UTC (rev 2709)
@@ -0,0 +1,32 @@
+/*
+ * LocalEntityResolver.java
+ *
+ * Created on 4 April 2006, 14:42
+ *
+ */
+package no.schibstedsok.front.searchportal.configuration.loader;
+
+import org.apache.log4j.Logger;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+public final class LocalEntityResolver implements EntityResolver {
+
+    private static final Logger LOG = 
Logger.getLogger(LocalEntityResolver.class);
+    private static final String INFO_LOADING_DTD = "Loading local DTD ";
+
+
+    public InputSource resolveEntity(final String publicId, final String 
systemId) {
+
+        if (systemId.startsWith("http://sesam.no/dtds/";)) {
+            
+            final String rsc = systemId.substring(systemId.lastIndexOf('/'));
+            LOG.info(INFO_LOADING_DTD + rsc);
+            return new InputSource(getClass().getResourceAsStream(rsc));
+        } else {
+            // use the default behaviour
+            return null;
+        }
+    }
+
+}

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to