if(ProxyManager.getDefaultProxy(username) == null){
HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
PrintWriter out = response.getWriter();
out.println("<h3>Login to My Proxy server using Xregistry Interface's Proxy Configration link or ProxyManager Portlet!</h3><br>");
out.close();
throw new GfacGUIException("Login to My Proxy server using Xregistry Interface's Proxy Configration link or ProxyManager Portlet");
}
context.setGssCredential(ProxyManager.getDefaultProxy(username));
// to create RegistryService instance
context.load();
facesContext.getExternalContext().getSessionMap().put("applicationGlobalContext", context);
this.setContext(context);
checkStatus = true;
}else{
UserInfo userInfo = (UserInfo) facesContext.getExternalContext().getSessionMap().get("userInfo");
String userName = userInfo.getUserName();
GSSCredential credential = ProxyManager.getDefaultProxy(userName);
if(credential != null){
context = new ApplicationGlobalContext();
context.setGssCredential(credential);
context.load();
facesContext.getExternalContext().getSessionMap().put("applicationGlobalContext", context);
this.setContext(context);
checkStatus = true;
}else{
FacesContext.getCurrentInstance().getExternalContext().redirect("ProxyConfigure.jsf");
}
}
} else {
checkStatus = true;
}
}
} catch (Exception e) {
String errormessage = new GfacGUIException(e).getMessage();
setErrorString(errormessage);
FacesMessage message = new FacesMessage(
FacesMessage.SEVERITY_ERROR, e.getClass().getName(),
errormessage);
currentInstance.addMessage(null, message);