Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.WebBundleDescriptor


            // loads the deployment descriptors
      Application app = loadDescriptors();
            // Set the generated XML directory in application desc
            request.getDescriptor().setGeneratedXMLDirectory(xmlDir.getAbsolutePath());
     
            WebBundleDescriptor bundleDesc = (WebBundleDescriptor) app.getStandaloneBundleDescriptor();

            // The priority order of how the context root should be used:
            // 1. Context root specified by user (via --contextRoot option
            // or via gui), i.e. request.getContextRoot()
            // 2. Context root specified in sun-web.xml i.e.
            // bundleDesc.getContextRoot()
            // 3. The default context root (archive name etc) i.e.
            // req.getDefaultContextRoot()

            if (request.getContextRoot() == null ||
                request.getContextRoot().trim().equals("")) {
                if (bundleDesc.getContextRoot() != null &&
                    !bundleDesc.getContextRoot().trim().equals("")) {
                    request.setContextRoot(bundleDesc.getContextRoot());
                } else {
                    request.setContextRoot(request.getDefaultContextRoot());
                }
            }
View Full Code Here


                webModulesMgr =
                    (WebModulesManager)createConfigManager(getInstanceEnv(),
                                                           moduleEnv);
            }
      Application app = request.getDescriptor();
            WebBundleDescriptor wbd = (WebBundleDescriptor) app.getStandaloneBundleDescriptor();
          
            // other things like creating the WebSecurityManager
            // this should create all permissions
            WebSecurityManager.createManager(wbd,true);
           
View Full Code Here

            if (uri != null && (!uri.startsWith("/"))) {
                uri = "/" + uri;
            }

            if (wse.implementedByWebComponent()) {
                WebBundleDescriptor wbd = (WebBundleDescriptor)
                    wse.getBundleDescriptor();
                if (wbd != null) {
                    String contextRoot = wbd.getContextRoot();
                    if (contextRoot != null) {
                        if (!contextRoot.startsWith("/")) {
                            contextRoot = "/" + contextRoot;
                        }
                        uri = contextRoot + uri;
View Full Code Here

    public HttpServletHelper(String appContext, Map map,
            CallbackHandler cbh, String realmName,
            boolean isSystemApp, String defaultSystemProviderID) {

        WebBundleDescriptor webBundle = null;
        if (map != null) {
            webBundle =
                (WebBundleDescriptor)map.get(HttpServletConstants.WEB_BUNDLE);
            if (webBundle != null) {
                LoginConfiguration loginConfig = webBundle.getLoginConfiguration();
                if (loginConfig != null &&
                        LoginConfiguration.CLIENT_CERTIFICATION_AUTHENTICATION.equals(
                        loginConfig.getAuthenticationMethod())) {
                    this.realmName = CertificateRealm.AUTH_TYPE;
                } else {
                    this.realmName = realmName;
                }
            }
        }

        // set realmName before init
        init(GFServerConfigProvider.HTTPSERVLET, appContext,
                map, cbh);

        if (webBundle != null) {
            String policyContextId = WebSecurityManager.getContextID(webBundle);
            map.put(HttpServletConstants.POLICY_CONTEXT, policyContextId);

      SunWebApp sunWebApp = webBundle.getSunDescriptor();
      String pid = (sunWebApp != null ? sunWebApp.getAttributeValue
        (sunWebApp.HTTPSERVLET_SECURITY_PROVIDER) : null);
            boolean nullConfigProvider = false;

            if (isSystemApp && (pid == null || pid.length() == 0)) {
View Full Code Here

            }

            Iterator itr = webBundleDescriptors.iterator();
      while (itr.hasNext())
      {
    WebBundleDescriptor wbd = (WebBundleDescriptor) itr.next();
    String warDirName = FileUtils.makeFriendlyFilename(
                                wbd.getModuleDescriptor().getArchiveUri());
    File outDir = new File(getJSPDir(), warDirName);
    File inDir  = new File(getAppDir(),  warDirName);
    //String msg = "***** Call JSPCompiler(" + inDir.getPath()+ ", " + outDir.getPath() + ")";
    //logger.log(Level.SEVERE, msg);
    long time = System.currentTimeMillis();
View Full Code Here

                   //BundleDescriptor bd = sitr.next();
                   //if( bd instanceof WebBundleDescriptor ) {
                   // XXXX : Add the code below to this if  block
                   // }

                   WebBundleDescriptor wbd = (WebBundleDescriptor) sitr.next();
                   String name = WebSecurityManager.getContextID(wbd);
                   WebSecurityManager.createManager(wbd,true);
                   SecurityUtil.generatePolicyFile(name);
                   ExtensionModuleDeployer emd = PluggableDeploymentInfo.getExtensionModuleDeployer(mt);
                   if (emd != null) {
View Full Code Here

                new File(dir.toString()).mkdirs();
            }
            // END IT 6849

            Set wbds = appDesc.getWebBundleDescriptors();
            WebBundleDescriptor wbd = null;
            com.sun.enterprise.config.serverbeans.WebModule wm = null;
            WebModuleConfig wmInfo = null;
            for (Iterator itr = wbds.iterator(); itr.hasNext(); ) {
                StringBuffer dir = new StringBuffer(location);
                wbd = (WebBundleDescriptor) itr.next();
                String moduleName = wbd.getModuleDescriptor().getArchiveUri();
                dir.append(File.separator);
                dir.append(DeploymentUtils.getRelativeEmbeddedModulePath(location, moduleName));

                wm = new com.sun.enterprise.config.serverbeans.WebModule();
                //Hercules add
                wm.setConfigContext(eventConfigContext);
                //end Hercules add                       
                wm.setName(moduleName);
                wm.setContextRoot(wbd.getContextRoot());
                wm.setLocation(dir.toString());
                wm.setEnabled(true);
                wm.setObjectType(resourceType);

                wmInfo = new WebModuleConfig();
View Full Code Here

        if (adHocSubtrees != null) {
            ctx.addAdHocSubtrees(adHocSubtrees);
        }

        // Object containing web.xml information
        WebBundleDescriptor wbd = wmInfo.getDescriptor();

        //Set the context root
        String contextRoot = null;
        if (wmInfo.getBean() != null) {
            if( wmInfo.getBean() instanceof
                    com.sun.enterprise.config.serverbeans.WebModule) {
                 contextRoot =
                      ((com.sun.enterprise.config.serverbeans.WebModule)wmInfo.
                            getBean()).getContextRoot();
            } else {
                if("true".equals(((ExtensionModule)wmInfo.getBean()).
                         getElementPropertyByName("isConverged").getValue())) {
                    ExtensionModule emBean = (ExtensionModule)wmInfo.getBean();
                    contextRoot =
                            emBean.getElementPropertyByName("contextRoot").
                                                                     getValue();
                } else {
                    contextRoot = wmInfo.getModuleName();
                   
                }
                                    
            }
            ctx.setContextRoot(contextRoot);
            if (wbd != null) {
                wbd.setContextRoot(contextRoot);
            }
        } else {
            // Should never happen.
            _logger.log(Level.WARNING, "Unable to set context root", wmInfo);
        }       

        //
        // Ensure that the generated directory for JSPs in the document root
        // (i.e. those that are serviced by a system default-web-module)
        // is different for each virtual server.
        //
        String wmInfoWorkDir = wmInfo.getWorkDir();
        if (wmInfoWorkDir != null) {
            StringBuffer workDir = new StringBuffer(wmInfo.getWorkDir());
            if (wmName.equals(Constants.DEFAULT_WEB_MODULE_NAME)) {
                workDir.append("-");
                workDir.append(FileUtils.makeFriendlyFilename(vs.getID()));
            }
            ctx.setWorkDir(workDir.toString());
        }

       
        ClassLoader parentLoader = wmInfo.getParentLoader();
        if (parentLoader == null) {
            // Use the shared classloader as the parent for all
            // standalone web-modules
            parentLoader = _serverContext.getSharedClassLoader();
        }
        ctx.setParentClassLoader(parentLoader);

        Throwable exception = null;
        Switch sw = Switch.getSwitch();
        try{
            // Determine if an alternate DD is set for this web-module in
            // the application
            if (wbd != null) {
                String altDDName = wbd.getModuleDescriptor().
                                        getAlternateDescriptor();
                if (altDDName != null) {
                    // we should load the alt dd from generated/xml directory
                    // first, then fall back to original app location.

                    // if we have alt dd, it must be an embedded web module
                    String appName =  wmName.substring(0,
                        wmName.indexOf(Constants.NAME_SEPARATOR));
                    String appLoc =
                        appsManager.getGeneratedXMLLocation(appName);
                    if (! FileUtils.safeIsDirectory(appLoc)) {
                        appLoc = wmInfo.getLocation()+"/..";
                    }

                    if (altDDName.startsWith("/")) {
                        altDDName = appLoc+altDDName.trim();
                    }
                    else {
                        altDDName = appLoc+"/"+altDDName.trim();
                    }
                    Object[] objs = {altDDName, wmName};
                    _logger.log(Level.INFO, "webcontainer.altDDName", objs);
                    ctx.setAltDDName(altDDName);

                }
                // time to update the Web Services related information in
                // our runtime jsr77 mbeans. We publish two extra properties
                // hasWebServices and endpointAddresses for webservices
                // enable web applications.
                if (wbd.hasWebServices()) {
                    ctx.setHasWebServices(true);
                   
                    // creates the list of endpoint addresses
                    String[] endpointAddresses;
                    WebServicesDescriptor webService = wbd.getWebServices();
                    Vector endpointList = new Vector();
                    for (Iterator endpoints = webService.getEndpoints().iterator();
                    endpoints.hasNext();) {
                        WebServiceEndpoint wse = (WebServiceEndpoint) endpoints.next();
                        if (wbd.getContextRoot()!=null) {
                            endpointList.add(wbd.getContextRoot() + "/"
                                             + wse.getEndpointAddressUri());
                        } else {
                            endpointList.add(wse.getEndpointAddressUri());
                        }
                    }
                    endpointAddresses = new String[endpointList.size()];
                    endpointList.copyInto(endpointAddresses);
                   
                    ctx.setEndpointAddresses(endpointAddresses);
                   
                } else {
                    ctx.setHasWebServices(false);
                }
            }

            // Object containing sun-web.xml information
            SunWebApp iasBean = null;

            // The default context is the only case when wbd == null
            if (wbd != null)
                iasBean = wbd.getSunDescriptor();

            // set the sun-web config bean
            ctx.setIasWebAppConfigBean(iasBean);
            ctx.setID(wmName);

            // Configure SingleThreadedServletPools, work/tmp directory etc
            configureMiscSettings(ctx, iasBean, vs, displayContextPath);
          
            // Configure alternate docroots if dummy web module
            if (Constants.DEFAULT_WEB_MODULE_NAME.equals(ctx.getID())) {
                ctx.setAlternateDocBases(vs.getProperties());
            }
         
            // Configure the class loader delegation model, classpath etc
            Loader loader = configureLoader(ctx, iasBean, wmInfo);
           
            // Set the class loader on the DOL object
            if (wbd != null && wbd.hasWebServices())
                wbd.addExtraAttribute("WEBLOADER", loader);

            // Enable dynamic reloading only for Web Modules
            if ( wmInfo.getBean() instanceof
                     com.sun.enterprise.config.serverbeans.WebModule &&
                                                       _reloadingEnabled) {
               
                if (_reloadManager == null) {
                    _reloadManager = new StandaloneWebModulesManager(
                                                            _id,
                                                            _modulesRoot,
                                                            _pollInterval);
                }
                _reloadManager.addWebModule((com.sun.enterprise.config.serverbeans.WebModule)wmInfo.getBean());
           
             }

            // Configure the session manager and other related settings
            // HERCULES:mod - take into account if app is distributable
            // passing in WebBundleDescriptor which has info about whether
            // app is distributable
            ctx.configureSessionSettings(wbd, wmInfo);
            // END HERCULES:mod

            // set i18n info from locale-charset-info tag in sun-web.xml
            ctx.setI18nInfo();


            if (wbd != null) {
                String resourceType = null;
                if(wmInfo.getBean() instanceof
                             com.sun.enterprise.config.serverbeans.WebModule) {
                    resourceType =
                     ((com.sun.enterprise.config.serverbeans.WebModule)wmInfo.
                                                     getBean()).getObjectType();
                } else {
                    resourceType = ((ExtensionModule)wmInfo.getBean()).
                                                           getObjectType();
                }
                boolean isSystem = (resourceType != null &&
                    resourceType.startsWith("system-"));
                if ("null".equals(j2eeApplication)) {
                    /*
                     * Standalone webapps inherit the realm referenced by
                     * the virtual server on which they are being deployed,
                     * unless they specify their own
                     */ 
                    ctx.setRealm(getRealmAdapter(wbd, isSystem,  vs.getAuthRealmName()));
                } else {
                        ctx.setRealm(getRealmAdapter(wbd, isSystem, null));
                }
                configureSecurity(wbd, isSystem);
                sw.setDescriptorFor(ctx, wbd);

                // post processing DOL object for standalone web module
                if (wbd.getApplication() != null &&
                    wbd.getApplication().isVirtual()) {
                    wbd.visit((WebBundleVisitor) new WebValidatorWithoutCL());
                }

            }

            // Add virtual server mime mappings, if present
            addMimeMappings(ctx, vs.getMimeMap());

        } catch (Throwable ex){
            exception = ex;
        }

        if (wbd != null && wbd.getApplication() != null) {
            // no dummy web module
            String moduleName;
            // S1AS BEGIN WORKAROUND FOR 6174360
            if (wbd.getApplication().isVirtual()) {
                // this is a standalone module
                moduleName = wbd.getApplication().getRegistrationName();
            } else {
                moduleName = wbd.getModuleDescriptor().getArchiveUri();
            }
            // S1AS END WORKAROUND FOR 6174360
            ctx.setModuleName(moduleName);
        } else {
            ctx.setModuleName(Constants.DEFAULT_WEB_MODULE_NAME);
View Full Code Here

                                params);
                } else {
                    //end Hercules: add                    
                    String j2eeApplication = appDesc.getRegistrationName();
                    Set wbds = appDesc.getWebBundleDescriptors();
                    WebBundleDescriptor wbd = null;
                    for (Iterator itr = wbds.iterator(); itr.hasNext(); ) {
                        wbd = (WebBundleDescriptor) itr.next();

                        try {
                            Switch.getSwitch().getManagementObjectManager().
View Full Code Here

                new File(dir.toString()).mkdirs();
            }
            // END IT 6849

            Set ebds = appDesc.getExtnBundleDescriptors();
            WebBundleDescriptor wbd = null;
            WebModuleConfig wmInfo = null;
            for (Iterator itr = ebds.iterator(); itr.hasNext(); ) {
                StringBuffer dir = new StringBuffer(location);
                wbd = (WebBundleDescriptor) itr.next();
                String moduleName = wbd.getModuleDescriptor().getArchiveUri();
                dir.append(File.separator);
                dir.append(FileUtils.makeFriendlyFilename(moduleName));
                if (!(new File(dir.toString()).exists())) {
                    dir = new StringBuffer(location).append(
                        File.separator).append(moduleName);
                }

                ExtensionModule em = new ExtensionModule();
                //Hercules add
                em.setConfigContext(eventConfigContext);
                //end Hercules add                       
                em.setName(moduleName);
                       
                // If the bundle descriptor has no context root, then
                // its not a converged app. There is no contextRoot set.
                try {
                    ElementProperty isConvergedProperty = new ElementProperty();
                    isConvergedProperty.setName("isConverged");
                    if(wbd.getContextRoot() != null) {
                        ElementProperty contextRootProperty =
                            new ElementProperty();
                        contextRootProperty.setName("contextRoot");
                        contextRootProperty.setValue(wbd.getContextRoot());
                        isConvergedProperty.setValue("true");
                        em.addElementProperty(contextRootProperty);
                        em.addElementProperty(isConvergedProperty);
                    } else {
                        isConvergedProperty.setValue("false");
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.WebBundleDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.