Exemplo n.º 1
0
 public KrollCallback getCallback(String name) {
   Object value = proxy.getDynamicValue(name);
   if (value != null && value instanceof KrollCallback) {
     return (KrollCallback) value;
   }
   return null;
 }
Exemplo n.º 2
0
 public boolean validatesSecureCertificate() {
   if (proxy.hasDynamicValue("validatesSecureCertificate")) {
     return TiConvert.toBoolean(proxy.getDynamicValue("validatesSecureCertificate"));
   } else {
     if (proxy
         .getTiContext()
         .getTiApp()
         .getDeployType()
         .equals(TiApplication.DEPLOY_TYPE_PRODUCTION)) {
       return true;
     }
   }
   return false;
 }
Exemplo n.º 3
0
  public void open(String method, String url) {
    if (DBG) {
      Log.d(LCAT, "open request method=" + method + " url=" + url);
    }

    this.method = method;

    String cleanUrl = url;
    if (url.startsWith("http")) {
      int beginQ = url.indexOf('?');
      if (beginQ > 7 && url.length() > beginQ) {
        String left = url.substring(0, beginQ);
        String right = url.substring(beginQ + 1);
        // first decoding below, in case it's partially encoded already.
        cleanUrl = Uri.encode(Uri.decode(left), ":/") + "?" + Uri.encode(Uri.decode(right), "&=#");
      } else {
        cleanUrl = Uri.encode(Uri.decode(url), ":/#");
      }
    }

    uri = Uri.parse(cleanUrl);

    host = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme());
    if (uri.getUserInfo() != null) {
      credentials = new UsernamePasswordCredentials(uri.getUserInfo());
    }
    setReadyState(READY_STATE_OPENED);
    setRequestHeader("User-Agent", (String) proxy.getDynamicValue("userAgent"));
    // Causes Auth to Fail with twitter and other size apparently block X- as well
    // Ticket #729, ignore twitter for now
    if (!uri.getHost().contains("twitter.com")) {
      setRequestHeader("X-Requested-With", "XMLHttpRequest");
    } else {
      Log.i(LCAT, "Twitter: not sending X-Requested-With header");
    }
  }