use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class CategoriesTag method doStartTag.
@Override
public int doStartTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
ICategoryManager catManager = (ICategoryManager) ApsWebApplicationUtils.getBean(SystemConstants.CATEGORY_MANAGER, this.pageContext);
try {
List<SelectItem> categories = new ArrayList<SelectItem>();
Category root = (null != this.getRoot()) ? catManager.getCategory(this.getRoot()) : null;
if (null == root) {
root = catManager.getRoot();
}
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
String langCode = currentLang.getCode();
String reqTitStyle = this.getTitleStyle();
List<String> allowedStyles = Arrays.asList(ALLOWED_TITLE_TYPES);
String titleStyle = (null != reqTitStyle && (allowedStyles.contains(reqTitStyle))) ? reqTitStyle : null;
this.addSmallCategory(categories, root, langCode, titleStyle, catManager);
this.pageContext.setAttribute(this.getVar(), categories);
} catch (Throwable t) {
_logger.error("Error starting tag", t);
throw new JspException("Error starting tag", t);
}
return super.doStartTag();
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class CurrentPageTag method doEndTag.
@Override
public int doEndTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
Lang currentLang = (Lang) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG);
try {
IPage page = (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
if (this.getParam() == null || this.getParam().equals(TITLE_INFO)) {
this.extractPageTitle(page, currentLang, reqCtx);
} else if (this.getParam().equals(CODE_INFO)) {
this.setValue(page.getCode());
} else if (this.getParam().equals(OWNER_INFO)) {
this.extractPageOwner(page, reqCtx);
} else if (this.getInfo().equals(CHILD_OF_INFO)) {
this.extractIsChildOfTarget(page);
} else if (this.getInfo().equals(HAS_CHILD)) {
boolean hasChild = (page.getChildrenCodes() != null && page.getChildrenCodes().length > 0);
this.setValue(new Boolean(hasChild).toString());
}
this.evalValue();
} catch (Throwable t) {
_logger.error("error in doStartTag", t);
// ApsSystemUtils.logThrowable(t, this, "doStartTag");
throw new JspException("Error during tag initialization ", t);
}
return EVAL_PAGE;
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class CurrentWidgetTag method extractShowlet.
private Widget extractShowlet() {
ServletRequest req = this.pageContext.getRequest();
RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX);
Widget widget = null;
if (this.getFrame() < 0) {
widget = (Widget) reqCtx.getExtraParam((SystemConstants.EXTRAPAR_CURRENT_WIDGET));
} else {
IPage currentPage = (IPage) reqCtx.getExtraParam((SystemConstants.EXTRAPAR_CURRENT_PAGE));
Widget[] widgets = currentPage.getWidgets();
if (widgets != null) {
if (widgets.length > this.getFrame()) {
widget = widgets[this.getFrame()];
}
}
}
return widget;
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class HeadInfoOutputterTag method doStartTag.
public int doStartTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
HeadInfoContainer headInfo = (HeadInfoContainer) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_HEAD_INFO_CONTAINER);
int retVal;
List<Object> infos = headInfo.getInfos(this.getType());
if (infos != null) {
this._infos = infos;
this._index = 0;
retVal = EVAL_BODY_INCLUDE;
} else {
retVal = SKIP_BODY;
}
return retVal;
}
use of com.agiletec.aps.system.RequestContext in project entando-core by entando.
the class HeadInfoTag method doEndTag.
@Override
public int doEndTag() throws JspException {
ServletRequest request = this.pageContext.getRequest();
RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
try {
HeadInfoContainer headInfo = (HeadInfoContainer) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_HEAD_INFO_CONTAINER);
if (_type != null && (_info != null || _var != null)) {
Object info = _info;
if (_info != null) {
info = _info;
} else {
info = this.extractAttribute();
}
headInfo.addInfo(_type, info);
}
} catch (Throwable t) {
_logger.error("Error closing tag", t);
throw new JspException("Error closing tag ", t);
}
return super.doEndTag();
}
Aggregations