Package org.grails.web.pages.discovery

Examples of org.grails.web.pages.discovery.GroovyPageScriptSource


        if(webRequest != null) {
            HttpServletRequest request = webRequest.getCurrentRequest();
            controller = webRequest.getAttributes().getController(request);
        }
       
        GroovyPageScriptSource scriptSource;
        if (controller == null) {
            scriptSource = groovyPageLocator.findViewByPath(viewName);
        }
        else {
            scriptSource = groovyPageLocator.findView(controller, viewName);
        }
        if (scriptSource != null) {
            return createGroovyPageView(scriptSource.getURI(), scriptSource);
        }

        return createFallbackView(viewName);
    }
View Full Code Here


        if (isNotInclude && isSecurePath(pageName)) {
            sendNotFound(response, pageName);
        }
        else {

            GroovyPageScriptSource scriptSource = groovyPagesTemplateEngine.findScriptSource(pageName);

            if (scriptSource == null) {
                scriptSource = findPageInBinaryPlugins(pageName);
            }

            if (scriptSource == null || (isNotInclude && !scriptSource.isPublic())) {
                sendNotFound(response, pageName);
                return;
            }

            renderPageWithEngine(groovyPagesTemplateEngine, request, response, scriptSource);
View Full Code Here

    public Template createTemplateForUri(String uri) {
        return createTemplateForUri(new String[]{uri});
    }

    public Template createTemplateForUri(String[] uris)  {
        GroovyPageScriptSource scriptSource = findScriptSource(uris);

        if (scriptSource != null) {
            return createTemplate(scriptSource);
        }
        return null;
View Full Code Here

    public GroovyPageScriptSource findScriptSource(String uri) {
        return findScriptSource(new String[]{uri});
    }

    public GroovyPageScriptSource findScriptSource(String[] uris) {
        GroovyPageScriptSource scriptSource = null;

        for (String uri : uris) {
            scriptSource = groovyPageLocator.findPage(uri);
            if (scriptSource != null) break;
        }
View Full Code Here

     *
     * @param uri The URI to check
     * @return A Resource instance
     */
    public Resource getResourceForUri(String uri) {
        GroovyPageScriptSource scriptSource = getResourceWithinContext(uri);
        if (scriptSource != null && (scriptSource instanceof GroovyPageResourceScriptSource)) {
            return ((GroovyPageResourceScriptSource)scriptSource).getResource();
        }
        return new ServletContextResource(servletContext, uri);
    }
View Full Code Here

        return new ServletContextResource(servletContext, uri);
    }

    private GroovyPageScriptSource getResourceWithinContext(String uri) {
        Assert.state(groovyPageLocator != null, "TemplateEngine not initialised correctly, no [groovyPageLocator] specified!");
        GroovyPageScriptSource scriptSource = groovyPageLocator.findPage(uri);
        if (scriptSource != null) {
            return scriptSource;
        }
        return null;
    }
View Full Code Here

    private Template findAndCacheTemplate(TemplateVariableBinding pageScope, String templateName,
            String contextPath, String pluginName, final String uri) throws IOException {

        String templatePath = GrailsStringUtils.isNotEmpty(contextPath) ? GrailsResourceUtils.appendPiecesForUri(contextPath, templateName) : templateName;
        final GroovyPageScriptSource scriptSource;
        if (pluginName == null) {
            scriptSource = groovyPageLocator.findTemplateInBinding(templatePath, pageScope);
        else {
            scriptSource = groovyPageLocator.findTemplateInBinding(pluginName, templatePath, pageScope);
        }

        String cacheKey;
        if (scriptSource == null) {
            cacheKey = contextPath + pluginName + uri;
        } else {
            cacheKey = scriptSource.getURI();
        }

        return CacheEntry.getValue(templateCache, cacheKey, reloadEnabled ? GroovyPageMetaInfo.LASTMODIFIED_CHECK_INTERVAL : -1, null,
                new Callable<CacheEntry<Template>>() {
                    public CacheEntry<Template> call() {
View Full Code Here

TOP

Related Classes of org.grails.web.pages.discovery.GroovyPageScriptSource

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.