FacesContext facesContext = currentInstance;
ExternalContext extContext = facesContext.getExternalContext();
Object request = extContext.getRequest();
if (request instanceof PortletRequest) {
String username = null;
PortletRequest portletRequest = (PortletRequest)request;
Map<String,String> userInfo = (Map) portletRequest.getAttribute(PortletRequest.USER_INFO);
username = (userInfo!=null) ? (String) userInfo.get("user.name") : null;
if (username == null) {
username = portletRequest.getRemoteUser();
}
context = new ApplicationGlobalContext();
if(ProxyManager.getDefaultProxy(username) == null){
HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
PrintWriter out = response.getWriter();