/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.portal.kernel.servlet.taglib; import com.liferay.portal.kernel.log.Log; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @author Philip Jones */ public abstract class BaseJSPDynamicInclude extends BaseDynamicInclude { @Override public void include( HttpServletRequest request, HttpServletResponse response, String key) throws IOException { RequestDispatcher requestDispatcher = _servletContext.getRequestDispatcher(getJspPath()); try { requestDispatcher.include(request, response); } catch (ServletException se) { Log log = getLog(); log.error("Unable to include JSP " + getJspPath(), se); throw new IOException("Unable to include JSP " + getJspPath(), se); } } @Override public void register( DynamicInclude.DynamicIncludeRegistry dynamicIncludeRegistry) { } protected abstract String getJspPath(); protected abstract Log getLog(); protected void setServletContext(ServletContext servletContext) { _servletContext = servletContext; } private ServletContext _servletContext; }