Search in sources :

Example 1 with WebDeploymentDescriptorFile

use of org.glassfish.web.deployment.io.WebDeploymentDescriptorFile in project Payara by payara.

the class WebCheckMgrImpl method check.

/**
 * Check method introduced for WebServices integration
 *
 * @param descriptor Web descriptor
 */
public void check(Descriptor descriptor) throws Exception {
    // run persistence tests first.
    checkPersistenceUnits(WebBundleDescriptor.class.cast(descriptor));
    // a WebBundleDescriptor can have an WebServicesDescriptor
    checkWebServices(descriptor);
    // a WebBundleDescriptor can have  WebService References
    checkWebServicesClient(descriptor);
    if (verifierFrameworkContext.isPartition() && !verifierFrameworkContext.isWeb())
        return;
    // create document obj for all tld's defined in the war
    createTaglibDescriptors(descriptor);
    createFacesConfigDescriptor(descriptor);
    // run the ParseDD test
    if (getSchemaVersion(descriptor).compareTo("2.4") < 0) {
        // NOI18N
        WebDeploymentDescriptorFile ddf = new WebDeploymentDescriptorFile();
        File file = new File(getAbstractArchiveUri(descriptor), ddf.getDeploymentDescriptorPath());
        FileInputStream is = new FileInputStream(file);
        try {
            if (is != null) {
                Result result = new ParseDD().validateWebDescriptor(is);
                result.setComponentName(getArchiveUri(descriptor));
                setModuleName(result);
                verifierFrameworkContext.getResultManager().add(result);
                is.close();
            }
        } finally {
            try {
                if (is != null)
                    is.close();
            } catch (Exception e) {
            }
        }
    }
    super.check(descriptor);
}
Also used : WebDeploymentDescriptorFile(org.glassfish.web.deployment.io.WebDeploymentDescriptorFile) ParseDD(com.sun.enterprise.tools.verifier.tests.dd.ParseDD) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) File(java.io.File) WebDeploymentDescriptorFile(org.glassfish.web.deployment.io.WebDeploymentDescriptorFile) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 2 with WebDeploymentDescriptorFile

use of org.glassfish.web.deployment.io.WebDeploymentDescriptorFile in project Payara by payara.

the class WebArchivist method getPlainDefaultWebXmlBundleDescriptor.

/**
 * @return a non-validated WebBundleDescriptor corresponding to default-web.xml
 */
private WebBundleDescriptorImpl getPlainDefaultWebXmlBundleDescriptor() {
    WebBundleDescriptorImpl defaultWebBundleDesc = new WebBundleDescriptorImpl();
    InputStream fis = null;
    try {
        // parse default-web.xml contents
        URL defaultWebXml = getDefaultWebXML();
        if (defaultWebXml != null) {
            fis = defaultWebXml.openStream();
            WebDeploymentDescriptorFile wddf = new WebDeploymentDescriptorFile();
            wddf.setXMLValidation(false);
            defaultWebBundleDesc.addWebBundleDescriptor(wddf.read(fis));
        }
    } catch (Exception e) {
        logger.log(Level.WARNING, LogFacade.ERROR_PARSING);
    } finally {
        try {
            if (fis != null) {
                fis.close();
            }
        } catch (IOException ioe) {
        // do nothing
        }
    }
    return defaultWebBundleDesc;
}
Also used : InputStream(java.io.InputStream) WebDeploymentDescriptorFile(org.glassfish.web.deployment.io.WebDeploymentDescriptorFile) IOException(java.io.IOException) URL(java.net.URL) IOException(java.io.IOException) SAXParseException(org.xml.sax.SAXParseException)

Aggregations

IOException (java.io.IOException)2 WebDeploymentDescriptorFile (org.glassfish.web.deployment.io.WebDeploymentDescriptorFile)2 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)1 ParseDD (com.sun.enterprise.tools.verifier.tests.dd.ParseDD)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 SAXException (org.xml.sax.SAXException)1 SAXParseException (org.xml.sax.SAXParseException)1