private static String LOCAL_SERVER = "LOCALHOST"; private static String LOCAL_DOMAIN = "127.0"; //..................... //..................... // Find Specific Server, IP public void LoadServers() { // 2011.09.21.10.23.AM // TO DO: Load Server and IP info to NSF back-end, log failed attempts // Call HTTP Servlet Class to render a Server Name, and IP HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext .getCurrentInstance().getExternalContext().getRequest(); // declare String to hold the ServerName String DBServer = httpServletRequest.getServerName(); //Add Getter and Setter for this variable to submit its value to back-end UserIP = httpServletRequest.getRemoteAddr(); // Load Message to console for debugging purposes System.out.println("Found HTTP ServerName " + DBServer); System.out.println("Found HTTP ServerIP " + UserIP); // run through the results and compare against static values of // LOCAL_SERVER and LOCAL_DOMAIN if (DBServer.equalsIgnoreCase(LOCAL_SERVER) && UserIP.startsWith(LOCAL_DOMAIN)) // { try { FacesContext.getCurrentInstance().getExternalContext() .redirect("xpissuesform.xsp");// ./index.html } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } else // load Xpages form in question, throw error // if there is a problem try { // call FacesContext to redirect to page in question FacesContext.getCurrentInstance().getExternalContext() .redirect("xpnotauthorized.xsp"); } catch (IOException ex) { // TODO Auto-generated catch block ex.printStackTrace(); } } // }