public static boolean hasLiteralIPAddress ( URI resource ) { String host = resource . getHost ( ) ; if ( host == null || host . isEmpty ( ) ) { return false ; } // basic check for a '.'-separated numeric string for now return host . matches ( "([0-9A-Fa-f]|\\.){4,16}" ) ; }
We can make this tighter but IPAddressUtil is in a sun package sadly