⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtdentityresolver.java

📁 用Java实现的23个常用设计模式源代码
💻 JAVA
字号:
//$Id: DTDEntityResolver.java,v 1.4 2003/02/23 13:47:18 oneovthafew Exp $//Contributed by Markus Meissnerpackage net.sf.hibernate.util;import java.io.InputStream;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.xml.sax.EntityResolver;import org.xml.sax.InputSource;public class DTDEntityResolver implements EntityResolver {		Log log = LogFactory.getLog(DTDEntityResolver.class);		private static final String URL = "http://hibernate.sourceforge.net/";		public InputSource resolveEntity (String publicId, String systemId) {		if ( systemId!=null && systemId.startsWith(URL) ) {			log.debug("trying to locate " + systemId + " in classpath under net/sf/hibernate/");			// Search for DTD			ClassLoader classLoader = this.getClass().getClassLoader();			InputStream dtdStream = classLoader.getResourceAsStream( "net/sf/hibernate/" + systemId.substring( URL.length() ) );			if (dtdStream==null) {				log.debug(systemId + "not found in classpath");				return null;			}			else {				log.debug("found " + systemId + " in classpath");				InputSource source = new InputSource(dtdStream);				source.setPublicId(publicId);				source.setSystemId(systemId);				return source;			}		}		else {			// use the default behaviour			return null;		}	}	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -