Friday, May 21, 2010

Get application's browser path

/**
* This method is defined to get application's browser path
*
* @return ipPath
*/
public static String getIpPath() {
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
String contextPath = request.getContextPath();
StringBuffer requestURL = request.getRequestURL();

String ipPath = requestURL.substring(0, requestURL.indexOf(contextPath)) + contextPath;
System.out.println("Debug ipPath :" + ipPath);
return ipPath;
}

JSF Related topics: JCaptcha in JSF, Integrating Richfaces with JSF,Getting client and server sessionId in JSF,PopUp AlertMessagebox for JSF and more.....

No comments:

Post a Comment