/*
* Copyright (c) 2001-2007, Inversoft Inc., All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
package org.primeframework.mvc.control;
import java.io.Writer;
import org.primeframework.mvc.PrimeException;
import freemarker.template.TemplateDirectiveBody;
/**
* This class is a proxy for the FreeMarker directive body.
*
* @author Brian Pontarelli
*/
public class FreeMarkerBodyProxy implements Body {
private final TemplateDirectiveBody body;
public FreeMarkerBodyProxy(TemplateDirectiveBody body) {
this.body = body;
}
/**
* {@inheritDoc}
*/
public void render(Writer writer) {
if (body != null) {
try {
body.render(writer);
} catch (Exception e) {
throw new PrimeException(e);
}
}
}
}