public static String getRoot( HttpServletRequest request ) {
StringBuffer sbRoot = new StringBuffer( 50 );
sbRoot.append( "http://" ).append( request.getServerName() ).append( ":" ).append( request.getServerPort() );
String strContextPath = request.getContextPath();
if ( strContextPath != null && !strContextPath.equals( "/" ) ){
sbRoot.append( strContextPath );
}
sbRoot.append( "/" );
return sbRoot.toString();
}