Package freemarker.template

Examples of freemarker.template.Template.process()


        SimpleFeature f = SimpleFeatureBuilder.build(featureType, new Object[] {
                    "three", new Integer(3), new Double(3.3), gf.createPoint(new Coordinate(3, 3))
                }, "fid.3");

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        template.process(f, new OutputStreamWriter(output));
        template.process(f, new OutputStreamWriter(System.out));
       
        //This generates the following:
       
        //<h4>testType</h4>
View Full Code Here


                    "three", new Integer(3), new Double(3.3), gf.createPoint(new Coordinate(3, 3))
                }, "fid.3");

        ByteArrayOutputStream output = new ByteArrayOutputStream();
        template.process(f, new OutputStreamWriter(output));
        template.process(f, new OutputStreamWriter(System.out));
       
        //This generates the following:
       
        //<h4>testType</h4>
View Full Code Here

        map.put("parameters", new ArrayList());
        map.put("layerName", "layer");
        map.put("units", "degrees");
        map.put("pureCoverage", "false");
        map.put("styles", new ArrayList());
        template.process(map, new OutputStreamWriter(output));

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setValidating(false);
        dbf.setExpandEntityReferences(false);
       
View Full Code Here

                ctx.put( "LAYER", layer );
                ctx.put( "BASE_URL", baseUrl );
               
                Template t = cfg.getTemplate("opensearchdescription.ftl");
                PrintWriter writer = resp.getWriter();
                t.process(ctx, writer);
                writer.flush();
            }
            else {
                Map kvp = KvpRequestReader.parseKvpSet( req.getQueryString() );
                SyndFeed feed = null;
View Full Code Here

            templateLoader.putTemplate("template", template);
            Template t = templateConfig.getTemplate("template");
            // t.setEncoding(charset.name());
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            Writer w = new OutputStreamWriter(bos);
            t.process(feature, w);
            return bos.toString();
        } catch(Exception e) {
            throw new RuntimeException("Issues occurred processing the template", e);
        }
    }
View Full Code Here

    public void testFeatureCollection() throws Exception {
        Template template = cfg.getTemplate("FeatureCollection.ftl");

        StringWriter out = new StringWriter();
        template.process(features, out);
        assertEquals("fid.1\nfid.2\nfid.3\n", out.toString());
    }

    public void testFeatureSimple() throws Exception {
        Template template = cfg.getTemplate("FeatureSimple.ftl");
View Full Code Here

    public void testFeatureSimple() throws Exception {
        Template template = cfg.getTemplate("FeatureSimple.ftl");

        StringWriter out = new StringWriter();
        template.process(features.iterator().next(), out);

        //replace ',' with '.' for locales which use a comma for decimal point
        assertEquals("one\n1\n1.1\nPOINT (1 1)", out.toString().replace(',', '.'));
    }
View Full Code Here

    public void testFeatureDynamic() throws Exception {
        Template template = cfg.getTemplate("FeatureDynamic.ftl");

        StringWriter out = new StringWriter();
        template.process(features.iterator().next(), out);

        //replace ',' with '.' for locales which use a comma for decimal point
        assertEquals("string=one\nint=1\ndouble=1.1\ngeom=POINT (1 1)\n",
            out.toString().replace(',', '.'));
    }
View Full Code Here

  }
 
  public void viewPage(String page, Object rootmap, PrintWriter out) throws Exception {
    Template template = cfg.getTemplate(page + ".ftl");
    template.setEncoding("UTF-8");
    template.process(rootmap, out);
  }
 
}
View Full Code Here

            StringWriter out = new StringWriter();
            try {
                Map<String, Object> root = new HashMap<String, Object>();
                root.put("var", objectToRender);
                template.process(root, out);
                return out.toString();
            } finally {
                out.close();
            }
        } catch (IOException ioe) {
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.