List of usage examples for com.liferay.portal.kernel.servlet SessionErrors contains
public static boolean contains(PortletRequest portletRequest, String key)
From source file:com.liferay.portlet.wiki.action.EditPageAction.java
License:Open Source License
public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { try {//from w w w. j a va 2 s . co m ActionUtil.getNode(renderRequest); if (!SessionErrors.contains(renderRequest, DuplicatePageException.class.getName())) { getPage(renderRequest); } } catch (Exception e) { if (e instanceof NoSuchNodeException || e instanceof PageTitleException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass().getName()); return mapping.findForward("portlet.wiki.error"); } else if (e instanceof NoSuchPageException) { // Let edit_page.jsp handle this case } else { throw e; } } return mapping.findForward(getForward(renderRequest, "portlet.wiki.edit_page")); }
From source file:com.liferay.roles.admin.web.internal.portlet.RolesAdminPortlet.java
License:Open Source License
@Override protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { setAttributes(renderRequest);//www.j av a2 s .c om long roleId = ParamUtil.getLong(renderRequest, "roleId"); if (SessionErrors.contains(renderRequest, RequiredRoleException.class.getName()) && (roleId < 1)) { include("/view.jsp", renderRequest, renderResponse); } else if (SessionErrors.contains(renderRequest, DuplicateRoleException.class.getName()) || SessionErrors.contains(renderRequest, RequiredRoleException.class.getName()) || SessionErrors.contains(renderRequest, RoleNameException.class.getName())) { include("/edit_role.jsp", renderRequest, renderResponse); } else if (SessionErrors.contains(renderRequest, NoSuchRoleException.class.getName()) || SessionErrors.contains(renderRequest, PrincipalException.getNestedClasses()) || SessionErrors.contains(renderRequest, RoleAssignmentException.class.getName()) || SessionErrors.contains(renderRequest, RolePermissionsException.class.getName())) { include("/error.jsp", renderRequest, renderResponse); } else { super.doDispatch(renderRequest, renderResponse); } }
From source file:com.liferay.site.admin.web.internal.portlet.SiteAdminPortlet.java
License:Open Source License
@Override protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { renderRequest.setAttribute(SiteWebKeys.GROUP_SEARCH_PROVIDER, groupSearchProvider); renderRequest.setAttribute(SiteWebKeys.GROUP_URL_PROVIDER, groupURLProvider); if (SessionErrors.contains(renderRequest, NoSuchBackgroundTaskException.class.getName()) || SessionErrors.contains(renderRequest, NoSuchGroupException.class.getName()) || SessionErrors.contains(renderRequest, PrincipalException.getNestedClasses())) { include("/error.jsp", renderRequest, renderResponse); } else if (SessionErrors.contains(renderRequest, NoSuchLayoutSetException.class.getName())) { include("/view.jsp", renderRequest, renderResponse); } else {// www .j a v a 2s. c om super.doDispatch(renderRequest, renderResponse); } }
From source file:com.liferay.site.memberships.web.internal.portlet.SiteMembershipsPortlet.java
License:Open Source License
@Override protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { if (SessionErrors.contains(renderRequest, NoSuchGroupException.class.getName()) || SessionErrors.contains(renderRequest, NoSuchRoleException.class.getName()) || SessionErrors.contains(renderRequest, PrincipalException.getNestedClasses())) { include("/error.jsp", renderRequest, renderResponse); } else {/*from ww w .ja v a 2s . c o m*/ super.doDispatch(renderRequest, renderResponse); } }
From source file:com.liferay.staging.bar.web.internal.portlet.StagingBarPortlet.java
License:Open Source License
@Override protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { if (SessionErrors.contains(renderRequest, NoSuchGroupException.class.getName()) || SessionErrors.contains(renderRequest, PrincipalException.getNestedClasses()) || SessionErrors.contains(renderRequest, SystemException.class.getName())) { include("/error.jsp", renderRequest, renderResponse); } else {// ww w . j a v a2 s . c o m super.doDispatch(renderRequest, renderResponse); } }
From source file:com.liferay.taglib.ui.ErrorTag.java
License:Open Source License
@Override public int doEndTag() throws JspException { try {//from w ww .java2 s . c o m HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); PortletRequest portletRequest = (PortletRequest) request .getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); boolean includeEndPage = false; if (Validator.isNull(_key)) { if (!SessionErrors.isEmpty(portletRequest)) { includeEndPage = true; } } else { if (SessionErrors.contains(portletRequest, _key)) { includeEndPage = true; } } if (includeEndPage) { PortalIncludeUtil.include(pageContext, getEndPage()); String errorMarkerKey = (String) request.getAttribute("liferay-ui:error-marker:key"); String errorMarkerValue = (String) request.getAttribute("liferay-ui:error-marker:value"); if (Validator.isNotNull(errorMarkerKey) && Validator.isNotNull(errorMarkerValue)) { request.setAttribute(errorMarkerKey, errorMarkerValue); } } return EVAL_PAGE; } catch (Exception e) { throw new JspException(e); } }
From source file:com.liferay.taglib.ui.ErrorTag.java
License:Open Source License
@Override public int doStartTag() throws JspException { try {// www . j ava 2s .c o m HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); PortletRequest portletRequest = (PortletRequest) request .getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); request.setAttribute("liferay-ui:error:key", _key); request.setAttribute("liferay-ui:error:message", _message); request.setAttribute("liferay-ui:error:rowBreak", _rowBreak); request.setAttribute("liferay-ui:error:translateMessage", String.valueOf(_translateMessage)); if (Validator.isNotNull(_message)) { return SKIP_BODY; } if (SessionErrors.contains(portletRequest, _key)) { Object value = null; if (_exception != null) { value = SessionErrors.get(portletRequest, _exception.getName()); } else { value = SessionErrors.get(portletRequest, _key); } PortalIncludeUtil.include(pageContext, getStartPage()); if (value != null) { pageContext.setAttribute("errorException", value); } return EVAL_BODY_INCLUDE; } return SKIP_BODY; } catch (Exception e) { throw new JspException(e); } }
From source file:com.liferay.user.groups.admin.web.internal.portlet.UserGroupsAdminPortlet.java
License:Open Source License
@Override protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { if (SessionErrors.contains(renderRequest, NoSuchUserGroupException.class.getName()) || SessionErrors.contains(renderRequest, PrincipalException.getNestedClasses())) { include("/error.jsp", renderRequest, renderResponse); } else if (SessionErrors.contains(renderRequest, RequiredUserGroupException.class.getName())) { include("/view.jsp", renderRequest, renderResponse); } else if (SessionErrors.contains(renderRequest, DuplicateUserGroupException.class.getName()) || SessionErrors.contains(renderRequest, UserGroupNameException.class.getName())) { include("/edit_user_group.jsp", renderRequest, renderResponse); } else {/*from w ww . j a v a 2s . c om*/ super.doDispatch(renderRequest, renderResponse); } }
From source file:com.liferay.wiki.web.internal.portlet.action.EditPageMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { try {/* ww w. java 2 s . c o m*/ renderRequest.setAttribute(WikiWebKeys.WIKI_ENGINE_RENDERER, _wikiEngineRenderer); renderRequest.setAttribute(WikiWebKeys.WIKI_PAGE_TITLE_VALIDATOR, _wikiPageTitleValidator); WikiNode node = ActionUtil.getNode(renderRequest); renderRequest.setAttribute(WikiWebKeys.WIKI_NODE, node); if (!SessionErrors.contains(renderRequest, DuplicatePageException.class.getName())) { getPage(renderRequest); } } catch (Exception e) { if (e instanceof NoSuchNodeException || e instanceof PageTitleException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); } else if (e instanceof NoSuchPageException) { // Let edit_page.jsp handle this case } else { throw new PortletException(e); } } return "/wiki/edit_page.jsp"; }
From source file:com.slemarchand.webcontentraweditor.portlet.WebContentRawEditorPortlet.java
License:Open Source License
@Override protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { if (SessionErrors.contains(renderRequest, PrincipalException.class.getName())) { include("/error.jsp", renderRequest, renderResponse); } else {//from www . j a v a 2s.c om super.doDispatch(renderRequest, renderResponse); } }