@Override public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); if (jdbcUpgradeSessionFactoryBeanName == null && jndiUpgradeSessionFactoryBeanName == null) { throw new ConfigException("properties [jdbcUpgradeSessionFactoryBeanName] " + "and [jndiUpgradeSessionFactoryBeanName] of class [" + getClass().getName() + "] can not be both null"); } Assert.hasText(createSessionFactoryBeanName, "property [createSessionFactoryBeanName] of class [" + getClass().getName() + "] can not be 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; }
/** * 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; }