01: /* Copyright 2004 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.container.deploy;
07:
08: import java.io.InputStream;
09:
10: import org.jasig.portal.utils.ResourceLoader;
11: import org.xml.sax.EntityResolver;
12: import org.xml.sax.InputSource;
13:
14: /**
15: * Uses a local copy of the DTD which is normally located
16: * at http://java.sun.com/dtd/web-app_2_3.dtd. If we don't
17: * do this, we are likely to get screwed if the java.sun.com
18: * webserver goes down. This actually happened yesterday,
19: * March 1, 2004, and it caused the portlet container
20: * initialization to hang until it issued a socket connection
21: * timeout exception.
22: * @author Ken Weiner, kweiner@unicon.net
23: * @version $Revision: 35418 $
24: */
25: public class WebAppDtdResolver implements EntityResolver {
26:
27: /**
28: * Sets the input source to the dtd normally
29: * located at http://java.sun.com/dtd/web-app_2_3.dtd.
30: * @param publicId the public ID
31: * @param systemId the system ID
32: * @return an input source based on the web-app dtd
33: */
34: public InputSource resolveEntity(String publicId, String systemId) {
35: InputSource inputSource = null;
36:
37: try {
38: InputStream inStream = ResourceLoader
39: .getResourceAsStream(this .getClass(),
40: "/org/jasig/portal/container/deploy/web-app_2_3.dtd");
41: if (inStream != null) {
42: inputSource = new InputSource(inStream);
43: }
44: } catch (Exception e) {
45: throw new RuntimeException(e);
46: }
47:
48: return inputSource;
49: }
50:
51: }
|