Package freemarker.template

Examples of freemarker.template.Template.process()


                        //set it in the request because when the "action" tag is used a new VS and ActionContext is created
                        req.setAttribute(PARENT_TEMPLATE_WRITER, parentCharArrayWriter);
                    }

                    try {
                        template.process(model, parentCharArrayWriter);

                        if (isTopTemplate) {
                            parentCharArrayWriter.flush();
                            parentCharArrayWriter.writeTo(writer);
                        }
View Full Code Here


                            req.removeAttribute(PARENT_TEMPLATE_WRITER);
                            parentCharArrayWriter.close();
                        }
                    }
                } else {
                    template.process(model, writer);
                }
            } finally {
                // Give subclasses a chance to hook into postprocessing
                postTemplateProcess(template, model);
            }
View Full Code Here

                HashMap<String,Object> data = new HashMap<String,Object>();
                data.put("exception", e);
                data.put("unknown", Location.UNKNOWN);
                data.put("chain", chain);
                data.put("locator", new Locator());
                template.process(data, response.getWriter());
                response.getWriter().close();
            } catch (Exception exp) {
                try {
                    response.sendError(code, "Unable to show problem report: " + exp);
                } catch (IOException ex) {
View Full Code Here

                fmcontext.put("doc", nodeModel);
                BeansWrapper wrapper = BeansWrapper.getDefaultInstance();
                TemplateHashModel staticModels = wrapper.getStaticModels();
                fmcontext.put("Static", staticModels);

                template.process(fmcontext, outWriter);
                s = outWriter.toString();
            } catch (Exception ex) {
                return ServiceUtil.returnError("ERROR processing template file (" + fmfilename + "): " + ex.getMessage());
            }
        }
View Full Code Here

                    BeansWrapper wrapper = BeansWrapper.getDefaultInstance();
                    TemplateHashModel staticModels = wrapper.getStaticModels();
                    context.put("Static", staticModels);

                    context.put("doc", nodeModel);
                    template.process(context, outWriter);
                    String s = outWriter.toString();
                    if (Debug.verboseOn()) Debug.logVerbose("transformed xml: " + s, module);

                    EntitySaxReader reader = new EntitySaxReader(delegator);
                    reader.setUseTryInsertMethod(this.useTryInsertMethod);
View Full Code Here

            SimpleSequence simpleList = new SimpleSequence(entityList);
            Map<String, Object> ctx = FastMap.newInstance();
            ctx.put("entityList", simpleList);
            StringWriter outWriter = new StringWriter();
            Template template = getDocTemplate(page);
            template.process(ctx, outWriter);
            outWriter.close();
            result = outWriter.toString();
            Debug.logInfo(result, result);
            response.getWriter().print(result);
        } catch (FileNotFoundException e) {
View Full Code Here

        model.put("res", Math.max(bbox.getHeight(),bbox.getWidth())/256d);
    }
    String renderTemplate(String t, Object model) throws Exception {
        Template template = config.getTemplate(t);
        StringWriter writer = new StringWriter();
        template.process(model, writer);
        return writer.toString();
    }
   
}
View Full Code Here

                template = templateConfig.getTemplate("kmlDescription.ftl");
            }

            try {
                template.setEncoding("UTF-8");
                template.process(feature, this);
            } catch (TemplateException e) {
                String msg = "Error occured processing template.";
                throw (IOException) new IOException(msg).initCause(e);
            }
        }
View Full Code Here

      } else {
        map.put("layerName", "Geoserver layers");
      }

      template.setOutputEncoding("UTF-8");
      template.process(map, new OutputStreamWriter(out, Charset.forName("UTF-8")));
    } catch (TemplateException e) {
      throw new WmsException(e);
    }

    mapContext = null;
View Full Code Here

            FeatureCollection<SimpleFeatureType, SimpleFeature> fc = (FeatureCollection) it.next();
            if(fc.size() > 0) {
                SimpleFeatureType ft = fc.getSchema();
                Template content = getTemplate(ft, "content.ftl", charSet);
                try {
                    content.process(fc, osw);
                } catch(TemplateException e) {
                    String msg = "Error occured processing content template " +
                    content.getName() + " for " + ft.getTypeName();
                    throw (IOException) new IOException(msg).initCause(e);
                }
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.