Package org.grails.web.pages

Examples of org.grails.web.pages.GroovyPagesUriSupport


            GrailsWebRequest webRequest = (GrailsWebRequest)RequestContextHolder.currentRequestAttributes();
            return (GroovyPagesUriSupport)webRequest.getAttributes().getGroovyPagesUriService();
        }
        catch (IllegalStateException e) {
            // returning non cached version, just for backwards compatibility
            return new GroovyPagesUriSupport();
        }
    }
View Full Code Here


* @since 1.0
*/
public class GroovyPageUtilsTests extends TestCase {

    public void testGetViewURI() {
        GroovyPagesUriSupport uriSupport = new GroovyPagesUriSupport();
        assertEquals("/foo/bar.gsp", uriSupport.getViewURI("foo", "bar"));
        assertEquals("/bar/foo.gsp", uriSupport.getViewURI("foo", "/bar/foo"));
        assertEquals("/foo/bar/foo.gsp", uriSupport.getViewURI("foo", "bar/foo"));
    }
View Full Code Here

        assertEquals("/bar/foo.gsp", uriSupport.getViewURI("foo", "/bar/foo"));
        assertEquals("/foo/bar/foo.gsp", uriSupport.getViewURI("foo", "bar/foo"));
    }

    public void testNoSuffxGetViewURI() {
        GroovyPagesUriSupport uriSupport = new GroovyPagesUriSupport();
        assertEquals("/foo/bar", uriSupport.getNoSuffixViewURI("foo", "bar"));
        assertEquals("/bar/foo", uriSupport.getNoSuffixViewURI("foo", "/bar/foo"));
        assertEquals("/foo/bar/foo", uriSupport.getNoSuffixViewURI("foo", "bar/foo"));
    }
View Full Code Here

        assertEquals("/bar/foo", uriSupport.getNoSuffixViewURI("foo", "/bar/foo"));
        assertEquals("/foo/bar/foo", uriSupport.getNoSuffixViewURI("foo", "bar/foo"));
    }

    public void testGetTemplateURI() {
        GroovyPagesUriSupport uriSupport = new GroovyPagesUriSupport();
        assertEquals("/foo/_bar.gsp", uriSupport.getTemplateURI("foo", "bar"));
        assertEquals("/bar/_foo.gsp", uriSupport.getTemplateURI("foo", "/bar/foo"));
        assertEquals("/foo/bar/_foo.gsp", uriSupport.getTemplateURI("foo", "bar/foo"));
    }
View Full Code Here

        assertEquals("/foo/bar/_foo.gsp", uriSupport.getTemplateURI("foo", "bar/foo"));
    }

    public void testGetTemplateURIForController() throws IllegalAccessException, InstantiationException {
        GroovyObject controller = (GroovyObject) new GroovyClassLoader().parseClass("class FooController { }").newInstance();
        GroovyPagesUriSupport uriSupport = new GroovyPagesUriSupport();
        assertEquals("/foo/_bar.gsp", uriSupport.getTemplateURI(controller, "bar"));
        assertEquals("/bar/_foo.gsp", uriSupport.getTemplateURI(controller, "/bar/foo"));
        assertEquals("/foo/bar/_foo.gsp", uriSupport.getTemplateURI(controller, "bar/foo"));
    }
View Full Code Here

        assertEquals("/foo/bar/_foo.gsp", uriSupport.getTemplateURI(controller, "bar/foo"));
    }

    public void testGetViewURIForController() throws IllegalAccessException, InstantiationException {
        GroovyObject controller = (GroovyObject) new GroovyClassLoader().parseClass("class FooController { }").newInstance();
        GroovyPagesUriSupport uriSupport = new GroovyPagesUriSupport();
        assertEquals("/foo/bar.gsp", uriSupport.getViewURI(controller, "bar"));
        assertEquals("/bar/foo.gsp", uriSupport.getViewURI(controller, "/bar/foo"));
        assertEquals("/foo/bar/foo.gsp", uriSupport.getViewURI(controller, "bar/foo"));
    }
View Full Code Here

        assertEquals("/foo/bar/foo.gsp", uriSupport.getViewURI(controller, "bar/foo"));
    }

   public void testNoSuffixGetViewURIForController() throws IllegalAccessException, InstantiationException {
        GroovyObject controller = (GroovyObject) new GroovyClassLoader().parseClass("class FooController { }").newInstance();
        GroovyPagesUriSupport uriSupport = new GroovyPagesUriSupport();
        assertEquals("/foo/bar", uriSupport.getNoSuffixViewURI(controller, "bar"));
        assertEquals("/bar/foo", uriSupport.getNoSuffixViewURI(controller, "/bar/foo"));
        assertEquals("/foo/bar/foo", uriSupport.getNoSuffixViewURI(controller, "bar/foo"));
    }
View Full Code Here

TOP

Related Classes of org.grails.web.pages.GroovyPagesUriSupport

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.