Package org.apache.velocity.app.event.implement

Examples of org.apache.velocity.app.event.implement.EscapeHtmlReference


     * Test escaping
     * @throws Exception
     */
    public void testEscapeHtml() throws Exception
    {
        EscapeReference esc = new EscapeHtmlReference();
        assertEquals("test string&amp;another&lt;b&gt;bold&lt;/b&gt;test",esc.referenceInsert("","test string&another<b>bold</b>test"));
        assertEquals("&lt;&quot;&gt;",esc.referenceInsert("","<\">"));
        assertEquals("test string",esc.referenceInsert("","test string"));
    }
View Full Code Here


     * Test escaping
     * @throws Exception
     */
    public void testEscapeHtml() throws Exception
    {
        EscapeReference esc = new EscapeHtmlReference();
        assertEquals("test string&amp;another&lt;b&gt;bold&lt;/b&gt;test",esc.referenceInsert("","test string&another<b>bold</b>test"));
        assertEquals("&lt;&quot;&gt;",esc.referenceInsert("","<\">"));
        assertEquals("test string",esc.referenceInsert("","test string"));
    }
View Full Code Here

     * Test escaping
     * @throws Exception
     */
    public void testEscapeHtml() throws Exception
    {
        EscapeReference esc = new EscapeHtmlReference();
        assertEquals("test string&amp;another&lt;b&gt;bold&lt;/b&gt;test",esc.referenceInsert("","test string&another<b>bold</b>test"));
        assertEquals("&lt;&quot;&gt;",esc.referenceInsert("","<\">"));
        assertEquals("test string",esc.referenceInsert("","test string"));

        log("Correctly escaped HTML");

    }
View Full Code Here

     * Test escaping
     * @throws Exception
     */
    public void testEscapeHtml() throws Exception
    {
        EscapeReference esc = new EscapeHtmlReference();
        assertEquals("test string&amp;another&lt;b&gt;bold&lt;/b&gt;test",esc.referenceInsert("","test string&another<b>bold</b>test"));
        assertEquals("&lt;&quot;&gt;",esc.referenceInsert("","<\">"));
        assertEquals("test string",esc.referenceInsert("","test string"));

        log("Correctly escaped HTML");

    }
View Full Code Here

     * Test escaping
     * @throws Exception
     */
    public void testEscapeHtml() throws Exception
    {
        EscapeReference esc = new EscapeHtmlReference();
        assertEquals("test string&amp;another&lt;b&gt;bold&lt;/b&gt;test",esc.referenceInsert("","test string&another<b>bold</b>test"));
        assertEquals("&lt;&quot;&gt;",esc.referenceInsert("","<\">"));
        assertEquals("test string",esc.referenceInsert("","test string"));

        System.out.println("Correctly escaped HTML");

    }
View Full Code Here

                // build the HTML body
                vt = velocityEngine.getTemplate(template.getHtmlBodyTemplateResourcePath());
                // HTML-escape all content inserted
                EventCartridge ec = new EventCartridge();
                ec.addEventHandler(new EscapeHtmlReference());
                ec.attachToContext(velocityContext);
                writer.getBuffer().setLength(0);
                vt.merge(velocityContext, writer);
                emailerFactory.setHtmlBody(response, writer.toString());
            }
View Full Code Here

            if (htmlBodyTemplateResourcePath != null)
            {
                vt = velocityEngine.getTemplate(htmlBodyTemplateResourcePath);
                // HTML-escape all content inserted
                EventCartridge ec = new EventCartridge();
                ec.addEventHandler(new EscapeHtmlReference());
                ec.attachToContext(velocityContext);
                if (!addresses.isEmpty())
                {
                    velocityContext.put("hasReplyAddress", false);
                    writer.getBuffer().setLength(0);
View Full Code Here

TOP

Related Classes of org.apache.velocity.app.event.implement.EscapeHtmlReference

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.