Search in sources :

Example 1 with GenericHandler

use of org.glassfish.internal.deployment.GenericHandler 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

String (java.lang.String)1 DeployCommandParameters (org.glassfish.api.deployment.DeployCommandParameters)1 GenericHandler (org.glassfish.internal.deployment.GenericHandler)1 WebBundleDescriptorImpl (org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl)1