@Override
  public String evaluate(String url, String host)
      throws ProxyEvaluationException {
    try {
      StringBuilder script = new StringBuilder(this.source.getScriptContent());
      String evalMethod = " ;FindProxyForURL (\"" + url + "\",\"" + host
          + "\")";
      script.append(evalMethod);
      Object result = this.engine.eval(script.toString());
      return (String) result;
    } catch (Exception e) {
      log.log(Level.INFO, "JS evaluation error.", e);
      throw new ProxyEvaluationException("Error while executing PAC script: "
          + e.getMessage(), e);
    }

  }
@Override
  public String evaluate(String url, String host)
      throws ProxyEvaluationException {
    try {
      StringBuilder script = new StringBuilder(this.source.getScriptContent());
      String evalMethod = " ;FindProxyForURL (\"" + url + "\",\"" + host
          + "\")";
      script.append(evalMethod);
      Object result = this.engine.eval(script.toString());
      return (String) result;
    } catch (Exception e) {
      log.log(Level.INFO, "JS evaluation error.", e);
      throw new ProxyEvaluationException("Error while executing PAC script: "
          + e.getMessage(), e);
    }

  }
@ Override public String evaluate ( String url , String host ) throws ProxyEvaluationException { try { StringBuilder script = new StringBuilder ( this . source . getScriptContent ( ) ) ; String evalMethod = " ;FindProxyForURL (\"" + url + "\",\"" + host + "\")" ; script . append ( evalMethod ) ; Object result = this . engine . eval ( script . toString ( ) ) ; return ( String ) result ; } catch ( Exception e ) { log . log ( Level . INFO , "JS evaluation error." , e ) ; throw new ProxyEvaluationException ( "Error while executing PAC script: " + e . getMessage ( ) , e ) ; } }
***********************************************************************
Evaluates the given URL and host against the PAC script.

@param url
the URL to evaluate.
@param host
the host name part of the URL.
@return the script result.
@throws ProxyEvaluationException
on execution error.
**********************************************************************
*********************************************************************** Evaluates the given URL and host against the PAC script .