List of usage examples for javax.servlet.jsp JspException JspException
public JspException(String message, Throwable cause)
JspException
with the specified detail message and cause. From source file:org.entando.entando.aps.tags.CheckWidgetOutputterTag.java
@Override public int doStartTag() throws JspException { ServletRequest req = this.pageContext.getRequest(); RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX); IPage page = (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE); try {// w ww . j a va2 s .c o m String widgetOutput[] = (String[]) reqCtx.getExtraParam("ShowletOutput"); if (_frame < 0 || _frame >= widgetOutput.length) { _logger.error("Frame attribute {} exceeds the limit in the page {}", _frame, page.getCode()); return SKIP_BODY; } String output = widgetOutput[_frame]; if (StringUtils.isBlank(output)) { return SKIP_BODY; } else { return EVAL_BODY_INCLUDE; } } catch (Throwable t) { String msg = "Error detected checking the output widget"; _logger.error("Error detected checking the output widget", t); throw new JspException(msg, t); } }
From source file:org.entando.entando.aps.tags.GuiFragmentTag.java
@Override public int doStartTag() throws JspException { ServletRequest request = this.pageContext.getRequest(); RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX); try {// w w w. j a v a2 s .co m Object extractedValue = this.extractFragmentOutput(reqCtx); if (null == extractedValue) { _logger.info("The fragment '{}' is not available", this.getCode()); extractedValue = "The fragment '" + this.getCode() + "' is not available"; } if (this.getVar() != null) { this.pageContext.setAttribute(this.getVar(), extractedValue); } else { if (this.getEscapeXml()) { out(this.pageContext, this.getEscapeXml(), extractedValue); } else { this.pageContext.getOut().print(extractedValue); } } } catch (Throwable t) { _logger.error("error in doStartTag", t); throw new JspException("Error during tag initialization", t); } return super.doStartTag(); }
From source file:org.entando.entando.apsadmin.tags.ShortcutListTag.java
@Override public int doStartTag() throws JspException { UserDetails currentUser = (UserDetails) this.pageContext.getSession() .getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER); try {/*from ww w . j a v a 2s .c om*/ Object retval = null; IShortcutManager shortcutManager = (IShortcutManager) ApsWebApplicationUtils .getBean(ApsAdminSystemConstants.SHORTCUT_MANAGER, this.pageContext); List<Shortcut> myShortcuts = shortcutManager.getAllowedShortcuts(currentUser); if (this.getType().equalsIgnoreCase(TYPE_LIST_OBJECT)) { retval = (Object) myShortcuts; } else if (this.getType().equalsIgnoreCase(TYPE_LIST_ITEMS)) { retval = (Object) this.getAllowedShortcutSelectItems(myShortcuts, currentUser); } else { _logger.warn("Invalid param for attribute 'value'. Expected '{}' or '{}' but was {}", TYPE_LIST_ITEMS, TYPE_LIST_OBJECT, this.getType()); } ValueStack stack = super.getStack(); stack.getContext().put(this.getVar(), retval); stack.setValue("#attr['" + this.getVar() + "']", retval, false); } catch (Throwable t) { _logger.error("Error extracting shortcuts for user '{}'", currentUser.getUsername(), t); throw new JspException("Error extracting shortcuts", t); } return super.doStartTag(); }
From source file:org.entando.entando.plugins.jacms.aps.tags.RowContentListTag.java
@Override public int doEndTag() throws JspException { ServletRequest request = this.pageContext.getRequest(); RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX); try {//from w w w. j ava2 s . com this.extractExtraWidgetParameters(reqCtx); List<Properties> contents = this.getContents(reqCtx); this.pageContext.setAttribute(this.getListName(), contents); } catch (Throwable t) { _logger.error("error in end tag", t); throw new JspException("Error detected while finalising the tag", t); } this.release(); return EVAL_PAGE; }
From source file:org.entando.entando.plugins.jpavatar.apsadmin.tags.AvatarTag.java
@Override public int doEndTag() throws JspException { try {// ww w . j a v a 2 s . co m IAvatarManager avatarManager = (IAvatarManager) ApsWebApplicationUtils .getBean(JpAvatarSystemConstants.AVATAR_MANAGER, pageContext); HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest(); UserDetails currentUser = (UserDetails) request.getSession() .getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER); boolean isCurrentUserGuest = null == currentUser || currentUser.getUsername().trim().length() == 0 || currentUser.getUsername().equalsIgnoreCase(SystemConstants.GUEST_USER_NAME); if (StringUtils.isBlank(this.getUsername()) && isCurrentUserGuest) { this.doOut(this.getNullAvatar(avatarManager)); } else { String username = this.getUsername(); if (StringUtils.isBlank(username)) { username = currentUser.getUsername(); } String avatarName = avatarManager.getAvatarUrl(username); if (null != avatarName) { this.doOut(avatarName); } else { this.doOut(this.getNullAvatar(avatarManager)); } } if (StringUtils.isNotBlank(this.getAvatarStyleVar())) { this.pageContext.getRequest().setAttribute(this.getAvatarStyleVar(), avatarManager.getConfig().getStyle()); } } catch (Throwable t) { _logger.info("Error on doEndTag", t); throw new JspException("Error on AvatarTag", t); } return EVAL_PAGE; }
From source file:org.entando.entando.plugins.jpoauth2.aps.tags.AuthenticatationTag.java
@Override public int doStartTag() throws JspException { HttpSession session = this.pageContext.getSession(); boolean hasLogged = false; boolean hasService = false; try {//from w w w .ja v a 2s . c o m OAuth2Session sessionServices = (OAuth2Session) session .getAttribute(OAuth2SystemConstants.SESSIONPARAM_SERVICE_OBJECT); AbstractOAuth2Service service = null; if (null != sessionServices && StringUtils.isNotBlank(_service)) { service = sessionServices.getServiceData(_service); } hasLogged = (sessionServices != null); hasService = hasLogged && (null != service); _logger.info("Currentuser authetication: hasLogged '{}', using service '{}'", hasLogged, hasService); if (StringUtils.isNotBlank(_var)) { boolean status = _service != null ? hasService : hasLogged; _logger.info("Returning overall result '{}'", status); this.pageContext.setAttribute(_var, new Boolean(status)); } } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "doStartTag"); throw new JspException("Errore tag", t); } if (hasLogged || hasService) { return EVAL_BODY_INCLUDE; } else { return SKIP_BODY; } }