1 23 24 package com.sun.enterprise.deployment.backend; 25 26 import java.io.File ; 27 import java.io.FileInputStream ; 28 import java.io.IOException ; 29 import java.util.logging.Level ; 30 31 import com.sun.enterprise.deployment.WebBundleDescriptor; 32 import com.sun.enterprise.deployment.Application; 33 import com.sun.enterprise.deployment.util.DOLUtils; 34 import com.sun.enterprise.deployment.io.WebDeploymentDescriptorFile; 35 import com.sun.enterprise.deployment.deploy.shared.FileArchive; 36 import com.sun.enterprise.deployment.util.DOLLoadingContextFactory; 37 38 import com.sun.enterprise.instance.InstanceEnvironment; 39 import com.sun.enterprise.server.ApplicationServer; 40 41 public class DOLLoadingContext { 42 private static final String DEFAULT_WEB_XML = "default-web.xml"; 43 44 48 public static WebBundleDescriptor initDefaultWebBundleDescriptor() { 49 DOLLoadingContextFactory.setParsingDefaultWebXML(true); 50 51 FileInputStream fis = null; 52 53 WebBundleDescriptor wbd = null; 54 try { 55 if (ApplicationServer.getServerContext() != null) { 58 InstanceEnvironment iEnv = ApplicationServer.getServerContext( 59 ).getInstanceEnvironment(); 60 61 String defaultWebXMLPath = iEnv.getConfigDirPath() + 62 File.separator + DEFAULT_WEB_XML; 63 File file = new File (defaultWebXMLPath); 64 if (file.exists()) { 65 fis = new FileInputStream (file); 66 WebDeploymentDescriptorFile wddf = 67 new WebDeploymentDescriptorFile(); 68 wddf.setXMLValidation(false); 69 wbd = (WebBundleDescriptor) wddf.read(fis); 70 } 71 } 72 return wbd; 73 } catch (Exception e) { 74 DOLUtils.getDefaultLogger().log(Level.WARNING, 75 "enterprise.deployment.default.web.xml.not.parsed", 76 new Object [] {e.getMessage()}); 77 return null; 78 } finally { 79 DOLLoadingContextFactory.setParsingDefaultWebXML(false); 80 try { 81 if (fis != null) { 82 fis.close(); 83 } 84 } catch (IOException ioe) { 85 } 87 } 88 } 89 } 90 | Popular Tags |