FileDocCategorySizeDatePackage
DOLLoadingContext.javaAPI DocGlassfish v2 API4405Fri May 04 22:34:30 BST 2007com.sun.enterprise.deployment.backend

DOLLoadingContext

public class DOLLoadingContext extends Object

Fields Summary
private static final String
DEFAULT_WEB_XML
Constructors Summary
Methods Summary
public static com.sun.enterprise.deployment.WebBundleDescriptorinitDefaultWebBundleDescriptor()
initialize the default WebBundleDescriptor from default-web.xml


               
        
        DOLLoadingContextFactory.setParsingDefaultWebXML(true);

        FileInputStream fis = null; 

        WebBundleDescriptor wbd = null;
        try {
            // parse default-web.xml contents 
            // (this path will not be invoked by portable static verifier)
            if (ApplicationServer.getServerContext() != null) {
                InstanceEnvironment iEnv = ApplicationServer.getServerContext(
                    ).getInstanceEnvironment();

                String defaultWebXMLPath = iEnv.getConfigDirPath() + 
                    File.separator + DEFAULT_WEB_XML;
                File file = new File(defaultWebXMLPath);
                if (file.exists()) {
                    fis = new FileInputStream(file);
                    WebDeploymentDescriptorFile wddf = 
                        new WebDeploymentDescriptorFile();
                    wddf.setXMLValidation(false);
                    wbd =  (WebBundleDescriptor) wddf.read(fis);
                }
            }
            return wbd;
        } catch (Exception e) {
            DOLUtils.getDefaultLogger().log(Level.WARNING, 
                "enterprise.deployment.default.web.xml.not.parsed", 
                 new Object[] {e.getMessage()});
            return null;
        } finally {
            DOLLoadingContextFactory.setParsingDefaultWebXML(false);
            try {
                if (fis != null) {
                    fis.close();
                }
            } catch (IOException ioe) {
                // do nothing
            }
        }