Package org.grails.web.servlet.context.support

Examples of org.grails.web.servlet.context.support.GrailsRuntimeConfigurator


        if (application.getParentContext() == null) {
            application.setApplicationContext(parent);
        }

        GrailsRuntimeConfigurator configurator = null;
        if (parent.containsBean(GrailsRuntimeConfigurator.BEAN_ID)) {
            // get configurator from parent application context
            configurator = (GrailsRuntimeConfigurator)parent.getBean(GrailsRuntimeConfigurator.BEAN_ID);
        }
        else {
            // get configurator from servlet context
            configurator = determineGrailsRuntimeConfiguratorFromServletContext(application, servletContext, parent);
        }

        if (configurator == null) {
            // no configurator, use default
            configurator = new GrailsRuntimeConfigurator(application,parent);
            if (parent.containsBean(GrailsPluginManager.BEAN_NAME)) {
                GrailsPluginManager pluginManager = (GrailsPluginManager)parent.getBean(GrailsPluginManager.BEAN_NAME);
                configurator.setPluginManager(pluginManager);
            }
        }

        final GrailsPluginManager pluginManager = configurator.getPluginManager();

        // return a context that obeys grails' settings
        WebApplicationContext webContext = configurator.configure(servletContext);
        pluginManager.setApplicationContext(webContext);

        configureServletContextAttributes(servletContext, application, pluginManager, webContext);
        LOG.info("[GrailsContextLoader] Grails application loaded.");
        return webContext;
View Full Code Here


        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, webContext);
    }

    public static GrailsRuntimeConfigurator determineGrailsRuntimeConfiguratorFromServletContext(
            GrailsApplication application, ServletContext servletContext, ApplicationContext parent) {
        GrailsRuntimeConfigurator configurator = null;

        if (servletContext.getInitParameter(GrailsRuntimeConfigurator.BEAN_ID + "Class") != null) {
            // try to load configurator class as specified in servlet context
            String configuratorClassName = servletContext.getInitParameter(
                    GrailsRuntimeConfigurator.BEAN_ID + "Class").toString();
View Full Code Here

        GrailsApplication app = new DefaultGrailsApplication(new Class[0], gcl);
        MockApplicationContext parent = new MockApplicationContext();
        parent.registerMockBean(GrailsApplication.APPLICATION_ID, app);

        GrailsRuntimeConfigurator conf = new GrailsRuntimeConfigurator(app,
                parent);
        DefaultGrailsPluginManager manager = new DefaultGrailsPluginManager(
                new Class[0], app);
        manager.setParentApplicationContext(parent);
        parent.registerMockBean("manager", manager);
        conf.setPluginManager(manager);

        List pluginList = new ArrayList();

        addPlugin(gcl, app, pluginList, "OneGrailsPlugin", null);
        addPlugin(gcl, app, pluginList, "TwoGrailsPlugin", "[one: 1.1]");
View Full Code Here

TOP

Related Classes of org.grails.web.servlet.context.support.GrailsRuntimeConfigurator

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.