Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* JavaBeanStack FrameWork
*
* Copyright (C) 2018 Jorge Enciso
* Email: [email protected]
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.javabeanstack.web.util;
import java.util.Iterator;
import java.util.Map;
import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.javabeanstack.error.IErrorReg;
import org.javabeanstack.security.model.IUserSession;
import org.javabeanstack.util.Fn;
import org.javabeanstack.util.Strings;
import org.primefaces.PrimeFaces;
public class FacesContextUtil {
private String messageView;
public String getMessageView() {
return messageView;
}
public void setMessageView(String messageView) {
this.messageView = messageView;
}
public FacesContext getFacesContext() {
return FacesContext.getCurrentInstance();
}
public Application getApplication() {
return getFacesContext().getApplication();
}
public PrimeFaces getRequestContext() {
return PrimeFaces.current();
}
public ExternalContext getExternalContext() {
return getFacesContext().getExternalContext();
}
public String getRequestContextPath() {
return getExternalContext().getRequestContextPath();
}
public String getRealPath(String path) {
return getExternalContext().getRealPath(path);
}
public UIViewRoot getUIViewRoot() {
ViewHandler viewHandler = getApplication().getViewHandler();
return viewHandler.createView(getFacesContext(), getFacesContext().getViewRoot().getViewId());
}
public HttpSession getSession() {
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest req = (HttpServletRequest) context.getExternalContext().getRequest();
HttpSession session = req.getSession();
return session;
}
public Map getSessionMap() {
return FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
}
public Map getRequestMap() {
return FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
}
public Map getRequestParameterMap() {
return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
}
public Map