/** * @return The current PortletRequest. */ private static PortletRequest getPortletRequest() { RequestAttributes requestAttributes = ContextUtils.getContextAttributes(); if (!ContextUtils.isPortlet()) { throw new UnsupportedOperationException( "call HttpUtils.getPortletRequest() in portlet mode only!"); } return ((PortletRequestAttributes) requestAttributes).getRequest(); }
/** * JSF callback. * @return a String. * @throws IOException */ public String logout() throws IOException { if (ContextUtils.isPortlet()) { throw new UnsupportedOperationException("logout() should not be called in portlet mode."); } FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext.getExternalContext(); HttpServletRequest request = (HttpServletRequest) externalContext.getRequest(); String returnUrl = request.getRequestURL().toString().replaceFirst("/stylesheets/[^/]*$", ""); String forwardUrl; Assert.hasText( casLogoutUrl, "property casLogoutUrl of class " + getClass().getName() + " is null"); forwardUrl = String.format(casLogoutUrl, StringUtils.utf8UrlEncode(returnUrl)); // note: the session beans will be kept even when invalidating // the session so they have to be reset (by the exception controller). // We invalidate the session however for the other attributes. request.getSession().invalidate(); request.getSession(true); // calling this method will reset all the beans of the application exceptionController.restart(); externalContext.redirect(forwardUrl); facesContext.responseComplete(); return null; }
/** * JSF callback. * @return a String. * @throws IOException */ public String logout() throws IOException { if (ContextUtils.isPortlet()) { throw new UnsupportedOperationException("logout() should not be called in portlet mode."); } FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = facesContext.getExternalContext(); HttpServletRequest request = (HttpServletRequest) externalContext.getRequest(); String returnUrl = request.getRequestURL().toString().replaceFirst("/stylesheets/[^/]*$", ""); String forwardUrl; Assert.hasText( casLogoutUrl, "property casLogoutUrl of class " + getClass().getName() + " is null"); forwardUrl = String.format(casLogoutUrl, StringUtils.utf8UrlEncode(returnUrl)); // note: the session beans will be kept even when invalidating // the session so they have to be reset (by the exception controller). // We invalidate the session however for the other attributes. request.getSession().invalidate(); request.getSession(true); // calling this method will reset all the beans of the application exceptionController.restart(); externalContext.redirect(forwardUrl); facesContext.responseComplete(); return null; }
if (ContextUtils.isPortlet()) { sb.append(TEXT_HRULE); sb.append(TEXT_CR + getString("EXCEPTION.HEADER.GLOBAL_SESSION_ATTRIBUTES"));
if (ContextUtils.isPortlet()) { Map<String, Object> userInfo = null; try {
if (ContextUtils.isPortlet()) { Map<String, Object> userInfo = null; try {
applicationVersion = getApplicationService().getVersion(); date = new Long(System.currentTimeMillis()); if (ContextUtils.isPortlet()) { portal = HttpUtils.getPortalInfo(); requestAttributes = ContextUtils.getRequestAttributesStrings(); sessionAttributes = ContextUtils.getSessionAttributesStrings(); if (ContextUtils.isPortlet()) { globalSessionAttributes = ContextUtils.getGlobalSessionAttributesStrings();