sb.append("(localhost)");
sb.append("((?i)localhost)");
   public String getPattern()   {   	StringBuilder sb = new StringBuilder();   	boolean first = true;   	   	// Append the allowed protocol scheme names		sb.append('(');   	for(Protocol protocol : getAllowedProtocols())   	{   		if(first)   		{   			first = false;   		}   		else   		{      		sb.append('|');   		}   		sb.append('(');   		sb.append(Pattern.quote(protocol.getSchemeName()));   		sb.append(Pattern.quote("://"));   		sb.append(')');   	}		sb.append(')');   	   	// Append the allowed host names		sb.append('(');		first = true;		   	// Append the allowed domain names   	for(String domain: getAllowedDomains())   	{   		if(first)   		{   			first = false;   		}   		else   		{      		sb.append('|');   		}   		sb.append('(');   		sb.append(Pattern.quote(domain));   		sb.append(')');   		   		if(isAllowIpAddresses())   		{      		sb.append('|');      		sb.append('(');      		sb.append(Pattern.quote(getIpAddress(domain)));      		sb.append(')');   		}   	}   	// Append special "localhost" URIs		if(isAllowLocalHost())		{   		if(first)   		{   			first = false;   		}   		else   		{      		sb.append('|');   		}   		sb.append("(localhost)");   		if(isAllowIpAddresses())			{	   		sb.append('|');	   		sb.append('(');	   		sb.append(Pattern.quote("127.0.0.1"));	   		sb.append(')');			}		}		sb.append(')');   	   	// Append the allowed port numbers		sb.append('(');		first = true;		   	for(Integer port : getAllowedPorts())   	{   		if(first)   		{   			first = false;   		}   		else   		{      		sb.append('|');   		}   		sb.append("(:");   		sb.append(port.toString());   		sb.append(')');   	}		sb.append(')');				if(isAllowDefaultPorts())		{			sb.append('?');		}		   	return sb.toString();   }