}
enrichedModel.put("encoder", new EncoderBean());
enrichedModel.put("request", getRequest());
return new TemplateRepresentation(template, enrichedModel, MediaType.TEXT_HTML);
}
else if (MediaType.TEXT_PLAIN.equals(variant.getMediaType()))
{
Map<String, Object> enrichedModel = new HashMap<String, Object>(getModel());
Template template;
try
{
VelocityEngine ve = new VelocityEngine();
Properties p = new Properties();
p.setProperty("resource.loader", "class");
p.setProperty("class.resource.loader.description",
"Velocity Classpath Resource Loader");
p.setProperty("class.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
ve.init(p);
template =
ve.getTemplate("jminix/templates/"
+ getTemplateName() + "-plain.vm");
}
catch (Exception e)
{
throw new RuntimeException(e);
}
enrichedModel.put("encoder", new EncoderBean());
enrichedModel.put("request", getRequest());
return new TemplateRepresentation(template, enrichedModel, MediaType.TEXT_PLAIN);
}
else if (MediaType.APPLICATION_JSON.equals(variant.getMediaType()))
{
// Translate known models, needs a refactoring to embed that in each resource...