/*
* Created on Mar 15, 2003
*/
package net.sf.jportlet.service.ssi;
import java.io.FileNotFoundException;
import java.io.IOException;
import net.sf.jportlet.portlet.PortletContext;
import net.sf.jportlet.portlet.PortletRequest;
import net.sf.jportlet.portlet.PortletResponse;
import net.sf.jportlet.service.PortletServiceException;
import net.sf.jportlet.service.velocity.VelocityService;
/**
* This class includes <a href="http://jakarta.apache.org/velocity">Velocity</a>
* files into the portlet response.
* This SSI depends on {@link net.sf.jportlet.service.velocity.VelocityService}
*
* @author <a href="mailto:tchbansi@sourceforge.net">Herve Tchepannou</a>
*/
public class SSIVelocity
extends SSIText
{
//~ Methods ----------------------------------------------------------------
/**
* @see net.sf.jportal.ssi.SSI#include(java.lang.String, net.sf.jportlet.portlet.PortletRequest, net.sf.jportlet.portlet.PortletResponse)
*/
public void include( String path,
PortletContext context,
PortletRequest request,
PortletResponse response )
throws PortletServiceException,
IOException
{
String templatePath = context.getResourcePath( path, request.getClient( ), request.getLocale( ) );
if ( templatePath == null )
{
throw new FileNotFoundException( path );
}
getVelocityService( ).merge( templatePath, request, response );
}
private VelocityService getVelocityService( )
throws PortletServiceException
{
return ( VelocityService ) _serviceContext.getPortletService( VelocityService.NAME );
}
}