Examples of LinkTool


Examples of org.apache.velocity.tools.view.tools.LinkTool

        params.put("a", new String[] { "a", "b", "c" } );
        InvocationHandler handler = new ServletAdaptor("/test", params);

        ViewContext vc = createViewContext(handler);

        LinkTool link = new LinkTool();
        link.init(vc);

        String url = link.setRelative("/target")
            .addAllParameters()
            .addQueryData("a", "d")
            .toString();

        Assert.assertEquals("/test/target?a=a&a=b&a=c&a=d", url);
View Full Code Here

Examples of org.apache.velocity.tools.view.tools.LinkTool

                                     handler);

        HttpServletRequest request = (HttpServletRequest)proxy;
        HttpServletResponse response = (HttpServletResponse)proxy;

        LinkTool link = new LinkTool();
        link.setRequest(request);
        link.setResponse(response);
        return link;
    }
View Full Code Here

Examples of org.apache.velocity.tools.view.tools.LinkTool

        return newLinkTool(params);
    }

    public @Test void testAddAllParameters()
    {
        LinkTool link = newLinkTool("a", "b");
        Assert.assertEquals("/test", link.getContextPath());

        String url = link.setRelative("/target")
            .addQueryData("foo", "bar")
            .addQueryData("bar", "baz")
            .addAllParameters()
            .toString();
View Full Code Here

Examples of org.apache.velocity.tools.view.tools.LinkTool

        Assert.assertEquals("/test/target?foo=bar&bar=baz&a=b", url);
    }

    public @Test void testAddMultiValueParameters()
    {
        LinkTool link = newLinkTool("a", new String[] { "a", "b", "c" });

        String url = link.setRelative("/target")
            .addQueryData("foo", "bar")
            .addQueryData("bar", "baz")
            .addAllParameters()
            .toString();
View Full Code Here

Examples of org.apache.velocity.tools.view.tools.LinkTool

    public @Test void testAddIgnoreParameters()
    {
        HashMap params = new HashMap();
        params.put("a", "b");
        params.put("b", "c");
        LinkTool link = newLinkTool(params);

        String url = link.setRelative("/target")
            .addQueryData("foo", "bar")
            .addQueryData("bar", "baz")
            .addIgnore("b")
            .addAllParameters()
            .toString();
View Full Code Here

Examples of org.apache.velocity.tools.view.tools.LinkTool

        Assert.assertEquals("/test/target?foo=bar&bar=baz&a=b", url);
    }

    public @Test void testAddAllParametersFirst()
    {
        LinkTool link = newLinkTool("a", "b");

        String url = link.setRelative("/target")
            .addAllParameters()
            .addQueryData("foo", "bar")
            .addQueryData("bar", "baz")
            .toString();
View Full Code Here

Examples of org.apache.velocity.tools.view.tools.LinkTool

        Assert.assertEquals("/test/target?a=b&foo=bar&bar=baz", url);
    }

    public @Test void testAddAdditionalValue()
    {
        LinkTool link = newLinkTool("a", "b");
        link.setAutoIgnoreParameters(false);

        String url = link.setRelative("/target")
            .addQueryData("a", "c")
            .addAllParameters()
            .toString();

        Assert.assertEquals("/test/target?a=c&a=b", url);
View Full Code Here

Examples of org.apache.velocity.tools.view.tools.LinkTool

        Assert.assertEquals("/test/target?a=c&a=b", url);
    }

    public @Test void testAddAdditionalValueAfter()
    {
        LinkTool link = newLinkTool("a", "b");
        link.setAutoIgnoreParameters(false);

        String url = link.setRelative("/target")
            .addAllParameters()
            .addQueryData("a", "c")
            .toString();

        Assert.assertEquals("/test/target?a=b&a=c", url);
View Full Code Here

Examples of org.apache.velocity.tools.view.tools.LinkTool

        Assert.assertEquals("/test/target?a=b&a=c", url);
    }

    public @Test void testAutoIgnore()
    {
        LinkTool link = newLinkTool("a", "b");

        String url = link.setRelative("/target")
            .addQueryData("a", "c")
            .toString();

        Assert.assertEquals("/test/target?a=c", url);
    }
View Full Code Here

Examples of org.apache.velocity.tools.view.tools.LinkTool

        Assert.assertEquals("/test/target?a=c", url);
    }

    public @Test void testAutoIgnoreMultiple()
    {
        LinkTool link = newLinkTool("a", new String[] { "a", "b", "c" });

        String url = link.setRelative("/target")
            .addQueryData("a", "d")
            .addAllParameters()
            .toString();

        Assert.assertEquals("/test/target?a=d", url);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.