Package org.apache.geronimo.jetty8.deployment

Examples of org.apache.geronimo.jetty8.deployment.JettyModuleBuilder


    }

    public UserIdentity newUserIdentity(Subject subject, Principal userPrincipal, String[] roles) {
        if (subject != null) {
            AccessControlContext acc = ContextManager.registerSubjectShort(subject, userPrincipal, roles == null? null: Arrays.asList(roles));
            return new GeronimoUserIdentity(subject, userPrincipal, acc);
        }
        return new GeronimoUserIdentity(null, null, defaultAcc);
    }
View Full Code Here


        Subject runAsSubject = runAsSource.getSubjectForRole(runAsName);
        return new GeronimoRunAsToken(runAsSubject);
    }

    public UserIdentity getSystemUserIdentity() {
        return new GeronimoUserIdentity(null, null, defaultAcc);
    }
View Full Code Here

                }
            }
        }

        IntegrationContext integrationContext = new IntegrationContext(componentContext, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator, userTransaction, bundle, holder, servletContainerInitializerMap, abName.toString());
        webAppContext = new GeronimoWebAppContext(securityHandler, sessionHandler, servletHandler, null, integrationContext, classLoader, modulePath, webAppInfo, policyContextID, applicationPolicyConfigurationManager);
        webAppContext.setContextPath(contextPath);
        //See Jetty-386.  Setting this to true can expose secured content.
        webAppContext.setCompactPath(compactPath);
        webAppContext.setWebModuleName(getWARName());
View Full Code Here

            }
        }

        IntegrationContext integrationContext = new IntegrationContext(componentContext, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator, userTransaction, bundle, holder, servletContainerInitializerMap, abName.getNameProperty(NameFactory.J2EE_NAME));
        List<String> webModuleListenerClassNames = (List<String>) deploymentAttributes.get(WebApplicationConstants.WEB_MODULE_LISTENERS);
        webAppContext = new GeronimoWebAppContext(securityHandler, sessionHandler, servletHandler, null, integrationContext, classLoader, modulePath, webAppInfo, policyContextID, applicationPolicyConfigurationManager,  webModuleListenerClassNames == null ? Collections.<String>emptyList() : webModuleListenerClassNames);
        webAppContext.setContextPath(contextPath);
        //See Jetty-386.  Setting this to true can expose secured content.
        webAppContext.setCompactPath(compactPath);
        webAppContext.setWebModuleName(getWARName());
View Full Code Here

        ServletHandler servletHandler = new ServletHandler();

        this.componentContext = contextSource.getContext();
        UserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
        integrationContext = new IntegrationContext(this.componentContext, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator, userTransaction, bundle);
        webAppContext = new GeronimoWebAppContext(securityHandler, sessionHandler, servletHandler, null, integrationContext, classLoader, modulePath);
        webAppContext.setContextPath(contextPath);
        //See Jetty-386.  Setting this to true can expose secured content.
        webAppContext.setCompactPath(compactPath);

        if (workDir == null) {
View Full Code Here

                    log.error("Fail to initialize ServletContainerInitializer " + servletContainerInitializerClassName, e);
                }
            }
        }

        IntegrationContext integrationContext = new IntegrationContext(componentContext, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator, userTransaction, bundle, holder, servletContainerInitializerMap, abName.toString());
        webAppContext = new GeronimoWebAppContext(securityHandler, sessionHandler, servletHandler, null, integrationContext, classLoader, modulePath, webAppInfo, policyContextID, applicationPolicyConfigurationManager);
        webAppContext.setContextPath(contextPath);
        //See Jetty-386.  Setting this to true can expose secured content.
        webAppContext.setCompactPath(compactPath);
        webAppContext.setWebModuleName(getWARName());

        if (workDir == null) {
            workDir = contextPath.replace('/', '_');
        }
        webAppContext.setTempDirectory(jettyContainer.resolveToJettyHome(workDir));


        //install jasper injection support if required
        if (contextCustomizer != null) {
            Map<String, Object> servletContext = new HashMap<String, Object>();
            Map<Class, Object> customizerContext = new HashMap<Class, Object>();
            customizerContext.put(Map.class, servletContext);
            customizerContext.put(Context.class, componentContext);
            contextCustomizer.customize(customizerContext);
            for (Map.Entry<String, Object> entry: servletContext.entrySet()) {
                webAppContext.setAttribute(entry.getKey(), entry.getValue());
            }
        }

        MimeTypes mimeTypes = new MimeTypes();
        mimeTypes.setMimeMap(webAppInfo.mimeMappings);
        webAppContext.setMimeTypes(mimeTypes);

        //DONT install the jetty TLD configuration as we find and create all the listeners ourselves
        webAppContext.setConfigurationClasses(new String[]{});

        webClassLoader = classLoader;
        webAppContext.setClassLoader(webClassLoader);

        if (host != null) {
            webAppContext.setConnectorNames(host.getHosts());
            webAppContext.setVirtualHosts(host.getVirtualHosts());
        }

        //stuff from spec dd
        webAppContext.setDisplayName(webAppInfo.displayName);
        webAppContext.getInitParams().putAll(webAppInfo.contextParams);
        webAppContext.setDistributable(webAppInfo.distributable);
        webAppContext.setWelcomeFiles(webAppInfo.welcomeFiles.toArray(new String[webAppInfo.welcomeFiles.size()]));
        for (Map.Entry<String, String> entry : webAppInfo.localeEncodingMappings.entrySet()) {
            this.webAppContext.addLocaleEncoding(entry.getKey(), entry.getValue());
        }
        ErrorPageErrorHandler errorHandler = (ErrorPageErrorHandler) this.webAppContext.getErrorHandler();
        for (ErrorPageInfo errorPageInfo: webAppInfo.errorPages) {
            if (errorPageInfo.exceptionType != null) {
                errorHandler.addErrorPage(errorPageInfo.exceptionType, errorPageInfo.location);
            } else {
                errorHandler.addErrorPage(errorPageInfo.errorCode, errorPageInfo.location);
            }
        }
        if (tagLibMap != null) {
            for (Map.Entry<String, String> entry : tagLibMap.entrySet()) {
                this.webAppContext.setResourceAlias(entry.getKey(), entry.getValue());
            }
        }

        if (!webAppInfo.distributable && webAppInfo.sessionConfig != null) {
            SessionManager sessionManager = this.webAppContext.getSessionHandler().getSessionManager();
            if (webAppInfo.sessionConfig.sessionTimeoutMinutes != -1) {
                sessionManager.setMaxInactiveInterval(webAppInfo.sessionConfig.sessionTimeoutMinutes * 60);
            }
            sessionManager.setSessionTrackingModes(webAppInfo.sessionConfig.sessionTrackingModes);
            if (webAppInfo.sessionConfig.sessionCookieConfig != null) {
                SessionCookieConfig cookieConfig = sessionManager.getSessionCookieConfig();
                cookieConfig.setName(webAppInfo.sessionConfig.sessionCookieConfig.name);
                cookieConfig.setPath(webAppInfo.sessionConfig.sessionCookieConfig.path);
                cookieConfig.setDomain(webAppInfo.sessionConfig.sessionCookieConfig.domain);
                cookieConfig.setComment(webAppInfo.sessionConfig.sessionCookieConfig.comment);
                cookieConfig.setHttpOnly(webAppInfo.sessionConfig.sessionCookieConfig.httpOnly);
                cookieConfig.setSecure(webAppInfo.sessionConfig.sessionCookieConfig.secure);
                cookieConfig.setMaxAge(webAppInfo.sessionConfig.sessionCookieConfig.maxAge);
            }
        }
        //supply web.xml to jasper
        webAppContext.setAttribute(JASPER_WEB_XML_NAME, originalSpecDD);
        WebBeansContext webBeansContext;
        if (sharedOwbContext == null) {
            webBeansContext = OpenWebBeansWebInitializer.newWebBeansContext(null);
        } else {
            webBeansContext= sharedOwbContext.getOWBContext();
        }
        Thread thread = Thread.currentThread();
        ClassLoader cl = thread.getContextClassLoader();
        thread.setContextClassLoader(classLoader);
        try {
            OpenWebBeansWebInitializer.initializeServletContext(webBeansContext, webAppContext.getServletContext());
        } finally {
            thread.setContextClassLoader(cl);
        }
        integrationContext.setOwbContext(webBeansContext);
    }
View Full Code Here

                    log.error("Fail to initialize ServletContainerInitializer " + servletContainerInitializerClassName, e);
                }
            }
        }

        IntegrationContext integrationContext = new IntegrationContext(componentContext, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator, userTransaction, bundle, holder, servletContainerInitializerMap, abName.getNameProperty(NameFactory.J2EE_NAME));
        List<String> webModuleListenerClassNames = (List<String>) deploymentAttributes.get(WebApplicationConstants.WEB_MODULE_LISTENERS);
        webAppContext = new GeronimoWebAppContext(securityHandler, sessionHandler, servletHandler, null, integrationContext, classLoader, modulePath, webAppInfo, policyContextID, applicationPolicyConfigurationManager,  webModuleListenerClassNames == null ? Collections.<String>emptyList() : webModuleListenerClassNames);
        webAppContext.setContextPath(contextPath);
        //See Jetty-386.  Setting this to true can expose secured content.
        webAppContext.setCompactPath(compactPath);
View Full Code Here

        ServletHandler servletHandler = new ServletHandler();

        this.componentContext = contextSource.getContext();
        UserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
        integrationContext = new IntegrationContext(this.componentContext, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator, userTransaction, bundle);
        webAppContext = new GeronimoWebAppContext(securityHandler, sessionHandler, servletHandler, null, integrationContext, classLoader, modulePath);
        webAppContext.setContextPath(contextPath);
        //See Jetty-386.  Setting this to true can expose secured content.
        webAppContext.setCompactPath(compactPath);
View Full Code Here

            }
        }

        @Override
        public void doStart() throws Exception {
            IntegrationContext integrationContext = servletRegistration.getIntegrationContext();
            javax.naming.Context context = integrationContext.setContext();
            boolean txActive = integrationContext.isTxActive();
            SharedConnectorInstanceContext newContext = integrationContext.newConnectorInstanceContext(null);
            ConnectorInstanceContext connectorContext = integrationContext.setConnectorInstance(null, newContext);
            try {
                try {
                    super.doStart();
                } finally {
                    integrationContext.restoreConnectorContext(connectorContext, null, newContext);
                }
            } finally {
                integrationContext.restoreContext(context);
                integrationContext.completeTx(txActive, null);
            }
        }
View Full Code Here

            }
        }

        @Override
        public void doStop() throws Exception {
            IntegrationContext integrationContext = servletRegistration.getIntegrationContext();
            javax.naming.Context context = integrationContext.setContext();
            boolean txActive = integrationContext.isTxActive();
            SharedConnectorInstanceContext newContext = integrationContext.newConnectorInstanceContext(null);
            ConnectorInstanceContext connectorContext = integrationContext.setConnectorInstance(null, newContext);
            try {
                try {
                    super.doStop();
                } finally {
                    integrationContext.restoreConnectorContext(connectorContext, null, newContext);
                }
            } finally {
                integrationContext.restoreContext(context);
                integrationContext.completeTx(txActive, null);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.jetty8.deployment.JettyModuleBuilder

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.