Package org.grails.web.servlet.mvc

Examples of org.grails.web.servlet.mvc.GrailsWebRequest$DefaultEncodingStateRegistryLookup


            assertEquals("/layouts/otherApplication.gsp", d.getPage());
            assertEquals("otherApplication", d.getName());
    }

    public void testDecoratedByControllerConvention() throws Exception {
        GrailsWebRequest webRequest = buildMockRequest(null);
        webRequest.setAttribute(GrailsLayoutDecoratorMapper.RENDERING_VIEW, Boolean.TRUE, RequestAttributes.SCOPE_REQUEST);
        MockApplicationContext appCtx = (MockApplicationContext)webRequest.getApplicationContext();
        appCtx.registerMockResource("/grails-app/views/layouts/test.gsp", "<html><body><g:layoutBody /></body></html>");

        MockHttpServletRequest request = (MockHttpServletRequest)webRequest.getCurrentRequest();
        request.setMethod("GET");
        request.setRequestURI("orders/list");
        ServletContext context = webRequest.getServletContext();
        GroovyClassLoader gcl = new GroovyClassLoader();

        // create mock controller
        GroovyObject controller = (GroovyObject)gcl.parseClass("class TestController {\n" +
                "def controllerName = 'test'\n" +
View Full Code Here


        assertEquals("/layouts/test.gsp", d.getPage());
        assertEquals("test", d.getName());
    }

    public void testDecoratedByActionConvention() throws Exception {
        GrailsWebRequest webRequest = buildMockRequest(null);
        webRequest.setAttribute(GrailsLayoutDecoratorMapper.RENDERING_VIEW, Boolean.TRUE, RequestAttributes.SCOPE_REQUEST);
        MockApplicationContext appCtx = (MockApplicationContext)webRequest.getApplicationContext();
        appCtx.registerMockResource("/grails-app/views/layouts/test2/testAction.gsp", "<html><body><g:layoutBody /></body></html>");

        MockHttpServletRequest request = (MockHttpServletRequest)webRequest.getCurrentRequest();
        request.setMethod("GET");
        request.setRequestURI("orders/list");
        ServletContext context = webRequest.getServletContext();
        GroovyClassLoader gcl = new GroovyClassLoader();

        // create mock controller
        GroovyObject controller = (GroovyObject)gcl.parseClass("class Test2Controller {\n" +
                "def controllerName = 'test2'\n" +
View Full Code Here

        assertEquals("/layouts/test2/testAction.gsp", d.getPage());
        assertEquals("test2/testAction", d.getName());
    }

    public void testDecoratedByLayoutPropertyInController() throws Exception {
        GrailsWebRequest webRequest = buildMockRequest(null);
        webRequest.setAttribute(GrailsLayoutDecoratorMapper.RENDERING_VIEW, Boolean.TRUE, RequestAttributes.SCOPE_REQUEST);
        MockApplicationContext appCtx = (MockApplicationContext)webRequest.getApplicationContext();
        appCtx.registerMockResource("/grails-app/views/layouts/test.gsp", "<html><body><g:layoutBody /></body></html>");
        appCtx.registerMockResource("/grails-app/views/layouts/mylayout.gsp", "<html><body><g:layoutBody /></body></html>");

        MockHttpServletRequest request = (MockHttpServletRequest)webRequest.getCurrentRequest();
        request.setMethod("GET");
        request.setRequestURI("orders/list");
        ServletContext context = webRequest.getServletContext();
        GroovyClassLoader gcl = new GroovyClassLoader();

        // create mock controller
        GroovyObject controller = (GroovyObject)gcl.parseClass("class TestController {\n" +
                "def controllerName = 'test'\n" +
View Full Code Here

TOP

Related Classes of org.grails.web.servlet.mvc.GrailsWebRequest$DefaultEncodingStateRegistryLookup

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.