protected static String getCacheKey ( URL url ) { String protocol = url . getProtocol ( ) . toLowerCase ( Locale . ROOT ) ; String host = url . getHost ( ) . toLowerCase ( Locale . ROOT ) ; int port = url . getPort ( ) ; if ( port == - 1 ) { port = url . getDefaultPort ( ) ; } /* * Robot rules apply only to host, protocol, and port where robots.txt * is hosted (cf. NUTCH-1752). Consequently */ return protocol + ":" + host + ":" + port ; }
Compose unique key to store and access robot rules in cache for given URL