public WhoisResult lookup ( String domain , int timeout ) { container . put ( "domain" , domain ) ; container . put ( "timeout_param" , timeout ) ; try { return ( WhoisResult ) container . runScriptlet ( JRubyWhois . class . getResourceAsStream ( "jruby-whois.rb" ) , "jruby-whois.rb" ) ; } catch ( EvalFailedException e ) { if ( e . getMessage ( ) . startsWith ( "(ServerNotFound)" ) ) { throw new ServerNotFoundException ( e ) ; } if ( e . getMessage ( ) . startsWith ( "(WebInterfaceError" ) ) { throw new WebInterfaceErrorException ( e ) ; } throw e ; } }
Uses the Ruby Whois gem to perform a whois lookup