Search in sources :

Example 11 with WebBundleDescriptorImpl

use of org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl in project Payara by payara.

the class WebDeployer method load.

@Override
public WebApplication load(WebContainer container, DeploymentContext dc) {
    super.load(container, dc);
    WebBundleDescriptorImpl wbd = dc.getModuleMetaData(WebBundleDescriptorImpl.class);
    if (wbd != null) {
        wbd.setClassLoader(dc.getClassLoader());
    }
    WebModuleConfig wmInfo = loadWebModuleConfig(dc);
    WebApplication webApp = new WebApplication(container, wmInfo, new ApplicationConfigInfo(dc.getAppProps()));
    return webApp;
}
Also used : WebBundleDescriptorImpl(org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl) ApplicationConfigInfo(org.glassfish.deployment.common.ApplicationConfigInfo)

Example 12 with WebBundleDescriptorImpl

use of org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl in project Payara by payara.

the class WebDeployer method runJSPC.

/**
 * This method setups the in/outDir and classpath and invoke
 * JSPCompiler.
 * @param dc - DeploymentContext to get command parameters and
 *             source directory and compile jsp directory.
 * @throws DeploymentException if JSPCompiler is unsuccessful.
 */
void runJSPC(final DeploymentContext dc) throws DeploymentException {
    final WebBundleDescriptorImpl wbd = dc.getModuleMetaData(WebBundleDescriptorImpl.class);
    try {
        final File outDir = dc.getScratchDir(env.kCompileJspDirName);
        final File inDir = dc.getSourceDir();
        StringBuilder classpath = new StringBuilder(super.getCommonClassPath());
        classpath.append(File.pathSeparatorChar);
        classpath.append(ASClassLoaderUtil.getModuleClassPath(sc.getDefaultServices(), wbd.getApplication().getName(), dc.getCommandParameters(DeployCommandParameters.class).libraries));
        classpath.append(File.pathSeparatorChar);
        classpath.append(super.getModuleClassPath(dc));
        JSPCompiler.compile(inDir, outDir, wbd, classpath.toString(), sc);
    } catch (DeploymentException de) {
        String msg = rb.getString(LogFacade.JSPC_FAILED);
        msg = MessageFormat.format(msg, wbd.getApplication().getName());
        logger.log(Level.SEVERE, msg, de);
        throw de;
    }
}
Also used : DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) WebBundleDescriptorImpl(org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl) DeploymentException(org.glassfish.deployment.common.DeploymentException) String(java.lang.String) File(java.io.File)

Example 13 with WebBundleDescriptorImpl

use of org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl in project Payara by payara.

the class WebDeployer method loadMetaData.

public <V> V loadMetaData(Class<V> type, DeploymentContext dc) {
    WebBundleDescriptorImpl wbd = dc.getModuleMetaData(WebBundleDescriptorImpl.class);
    if (wbd.isStandalone()) {
        // the context root should be set using the following precedence
        // for standalone web module
        // 1. User specified value through DeployCommand
        // 2. Context root value specified through sun-web.xml
        // 3. Context root from last deployment if applicable
        // 4. The default context root which is the archive name
        // minus extension
        DeployCommandParameters params = dc.getCommandParameters(DeployCommandParameters.class);
        String contextRoot = params.contextroot;
        if (contextRoot == null) {
            contextRoot = wbd.getContextRoot();
            if ("".equals(contextRoot))
                contextRoot = null;
        }
        if (contextRoot == null) {
            contextRoot = params.previousContextRoot;
        }
        if (contextRoot == null)
            contextRoot = ((GenericHandler) dc.getArchiveHandler()).getDefaultApplicationNameFromArchiveName(dc.getOriginalSource());
        if (!contextRoot.startsWith("/")) {
            contextRoot = "/" + contextRoot;
        }
        wbd.setContextRoot(contextRoot);
        wbd.setName(params.name());
        // set the context root to deployment context props so this value
        // will be persisted in domain.xml
        dc.getAppProps().setProperty(ServerTags.CONTEXT_ROOT, contextRoot);
    }
    return null;
}
Also used : DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) GenericHandler(org.glassfish.internal.deployment.GenericHandler) WebBundleDescriptorImpl(org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl) String(java.lang.String)

Aggregations

WebBundleDescriptorImpl (org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl)13 File (java.io.File)5 ErrorPageDescriptor (org.glassfish.web.deployment.descriptor.ErrorPageDescriptor)4 WebappClassLoader (org.glassfish.web.loader.WebappClassLoader)3 FileArchive (com.sun.enterprise.deploy.shared.FileArchive)2 Application (com.sun.enterprise.deployment.Application)2 String (java.lang.String)2 DeployCommandParameters (org.glassfish.api.deployment.DeployCommandParameters)2 Applications (com.sun.enterprise.config.serverbeans.Applications)1 ConfigBeansUtilities (com.sun.enterprise.config.serverbeans.ConfigBeansUtilities)1 TagLibDescriptor (com.sun.enterprise.tools.verifier.TagLibDescriptor)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 LogRecord (java.util.logging.LogRecord)1 ServletContainerInitializer (javax.servlet.ServletContainerInitializer)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 DeploymentContext (org.glassfish.api.deployment.DeploymentContext)1 ApplicationConfigInfo (org.glassfish.deployment.common.ApplicationConfigInfo)1 DeploymentException (org.glassfish.deployment.common.DeploymentException)1