All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sakaiproject.jsf2.app.SakaiNavigationHandler Maven / Gradle / Ivy

There is a newer version: 23.3
Show newest version
/**********************************************************************************
Copyright (c) 2018 Apereo Foundation

Licensed under the Educational Community License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

            http://opensource.org/licenses/ecl2

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
 **********************************************************************************/

package org.sakaiproject.jsf2.app;

import javax.faces.application.NavigationHandler;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

/**
 * 

* SakaiNavigationHandler catches the response that is being redirected to preserve the faces messages for the return request. *

* */ public class SakaiNavigationHandler extends NavigationHandler { /** The other navigation handler. */ protected NavigationHandler m_chain = null; /** * Construct. */ public SakaiNavigationHandler() { } /** * Construct. */ public SakaiNavigationHandler(NavigationHandler chain) { m_chain = chain; } /** * Handle the navigation * * @param context * The Faces context. * @param fromAction * The action string that triggered the action. * @param outcome * The logical outcome string, which is the new tool mode, or if null, the mode does not change. */ public void handleNavigation(FacesContext context, String fromAction, String outcome) { m_chain.handleNavigation(context, fromAction, outcome); // if we have a redirect scheduled, we need to preserve the messages // if we are coming from the Sakai RequestFilter, and a redirect was requested, the request object // will have this attribute set. HttpServletRequest req = (HttpServletRequest) context.getExternalContext().getRequest(); if (req.getAttribute("sakai.redirect") != null) { // save messages from the context for restoration on the next rendering MessageSaver.saveMessages(context); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy