com.liferay.application.list.taglib.servlet.taglib.PanelContentTag Maven / Gradle / Ivy
/**
* 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.application.list.taglib.servlet.taglib;
import com.liferay.application.list.PanelCategory;
import com.liferay.application.list.constants.ApplicationListWebKeys;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.taglib.servlet.PipingServletResponse;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
/**
* @author Eudaldo Alonso
*/
public class PanelContentTag extends BasePanelTag {
@Override
public int doEndTag() throws JspException {
request.setAttribute(
ApplicationListWebKeys.PANEL_CATEGORY, _panelCategory);
try {
boolean include = _panelCategory.include(
request,
PipingServletResponse.createPipingServletResponse(pageContext));
if (include) {
doClearTag();
return EVAL_PAGE;
}
}
catch (IOException ioe) {
_log.error("Unable to include panel category", ioe);
}
return super.doEndTag();
}
@Override
public int doStartTag() throws JspException {
return EVAL_BODY_INCLUDE;
}
public void setPanelCategory(PanelCategory panelCategory) {
_panelCategory = panelCategory;
}
@Override
protected void cleanUp() {
super.cleanUp();
_panelCategory = null;
}
@Override
protected String getPage() {
return _PAGE;
}
@Override
protected void setAttributes(HttpServletRequest request) {
request.setAttribute(
"liferay-application-list:panel-content:panelCategory",
_panelCategory);
}
private static final String _PAGE = "/panel_content/page.jsp";
private static final Log _log = LogFactoryUtil.getLog(
PanelContentTag.class);
private PanelCategory _panelCategory;
}