Package grails.core

Examples of grails.core.GrailsApplication


    }

    public static WebApplicationContext configureWebApplicationContext(final ServletContext servletContext, WebApplicationContext parent) {
        Holders.setServletContext(servletContext);
        Holders.addApplicationDiscoveryStrategy(new ServletEnvironmentGrailsApplicationDiscoveryStrategy(servletContext));
        GrailsApplication application = (GrailsApplication)parent.getBean(GrailsApplication.APPLICATION_ID);

        if (LOG.isDebugEnabled()) {
            LOG.debug("[GrailsContextLoader] Configuring Grails Application");
        }

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

        GrailsRuntimeConfigurator configurator = null;
        if (parent.containsBean(GrailsRuntimeConfigurator.BEAN_ID)) {
            // get configurator from parent application context
View Full Code Here


        throw new MissingMethodException(methodName, instance.getClass(), args);
    }
   
    private String getNamespace(Object instance) {
        GrailsApplication grailsApplication = getGrailsApplication(null);
        if (grailsApplication != null) {
            GrailsTagLibClass taglibrary = (GrailsTagLibClass) grailsApplication.getArtefact(TagLibArtefactHandler.TYPE, instance.getClass().getName());
            if (taglibrary != null) {
                return taglibrary.getNamespace();
            }
        }
        return TagOutput.DEFAULT_NAMESPACE;
View Full Code Here

        }
        return null;
    }
    private Encoder getRawEncoder(Object instance) {
        if(rawEncoder == null) {
            GrailsApplication application = getGrailsApplication(instance);
            rawEncoder = getRawEncoder(application);
        }
        return rawEncoder;
    }
View Full Code Here

    public static GrailsApplication lookupApplication(ServletContext servletContext) {
        if (servletContext == null) {
            return null;
        }

        GrailsApplication grailsApplication = (GrailsApplication)servletContext.getAttribute(ApplicationAttributes.APPLICATION);
        if(grailsApplication != null) {
            return grailsApplication;
        }

        final WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
View Full Code Here

    /**
     * @return The currently bound GrailsApplication instance
     * @since 2.0
     */
    public static Map currentConfiguration() {
        GrailsApplication application = currentApplication();
        return application == null ? new ConfigObject() : application.getConfig();
    }
View Full Code Here

    /**
     * @return The currently bound GrailsApplication instance
     * @since 2.0
     */
    public static Map currentFlatConfiguration() {
        GrailsApplication application = currentApplication();
        return application == null ? Collections.emptyMap() : application.getFlatConfig();
    }
View Full Code Here

    public void init(Config c, Properties properties, DecoratorMapper parentMapper) throws InstantiationException {
        super.init(c, properties, parentMapper);
        ServletContext servletContext = c.getServletContext();
        WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        if(applicationContext != null) {
            GrailsApplication grailsApplication = applicationContext.getBean(GrailsApplication.APPLICATION_ID, GrailsApplication.class);
            groovyPageLayoutFinder = grailsApplication.getMainContext().getBean("groovyPageLayoutFinder", GroovyPageLayoutFinder.class);
        }
    }
View Full Code Here

                else {
                    String urlPrefix = "";
                    if (gspFile == null) {
                        fileName = className.replace('.', '/') + ".groovy";

                        GrailsApplication application = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext).getBean(GrailsApplication.APPLICATION_ID, GrailsApplication.class);
                        // @todo Refactor this to get the urlPrefix from the ArtefactHandler
                        if (application.isArtefactOfType(ControllerArtefactHandler.TYPE, className)) {
                            urlPrefix += "/controllers/";
                        }
                        else if (application.isArtefactOfType(TagLibArtefactHandler.TYPE, className)) {
                            urlPrefix += "/taglib/";
                        }
                        else if (application.isArtefactOfType(ServiceArtefactHandler.TYPE, className)) {
                            urlPrefix += "/services/";
                        }
                        url = URL_PREFIX + urlPrefix + fileName;
                    }
                    else {
View Full Code Here

     * Returns true if the current executing request is a flow request
     *
     * @return true if it is a flow request
     */
    public boolean isFlowRequest() {
        GrailsApplication application = getAttributes().getGrailsApplication();
        Object controllerClassObject = getControllerClass();
        GrailsControllerClass controllerClass = null;
        if(controllerClassObject instanceof GrailsControllerClass) {
            controllerClass = (GrailsControllerClass) controllerClassObject;
        }
View Full Code Here

        return resolvedMultipartRequest;
    }

    private boolean getMultipartDisabled() {
        boolean disabled = false;
        GrailsApplication app = WebUtils.findApplication(servletContext);
        if(app != null) {
            Object disableMultipart = app.getFlatConfig().get(SETTING_GRAILS_WEB_DISABLE_MULTIPART);
            if (disableMultipart instanceof Boolean) {
                disabled = (Boolean)disableMultipart;
            }
            else if (disableMultipart instanceof String) {
                disabled = Boolean.valueOf((String)disableMultipart);
View Full Code Here

TOP

Related Classes of grails.core.GrailsApplication

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.