Examples of URLFetcher


Examples of biz.webgate.domino.mywebgate.util.URLFetcher

      Reader r = engine.getHttpRequest().getReader();
      json = (JsonJavaObject) JsonParser.fromJson(factory, r);
      String strMethod = "url.fetchmetadata"; //json.getString("method");
      String strLink = json.getString("link");
      if ("url.fetchmetadata".equalsIgnoreCase(strMethod)) {
        URLFetcher urlFetcher = new URLFetcher(strLink);
        if (urlFetcher.fetchURL()) {
          JsonWriter jsWriter = new JsonWriter(engine
              .getHttpResponse().getWriter(), true);
          jsWriter.startObject();
          jsWriter.startProperty("result");
          jsWriter.outStringLiteral("ok");
          jsWriter.endProperty();

          // Title
          jsWriter.startProperty("title");
          jsWriter.outStringLiteral(urlFetcher.getTitle());
          jsWriter.endProperty();
          // Description
          jsWriter.startProperty("desc");
          jsWriter.outStringLiteral(urlFetcher.getDescription());
          jsWriter.endProperty();
          // url
          jsWriter.startProperty("url");
          jsWriter.outStringLiteral(urlFetcher.getURL());
          jsWriter.endProperty();

          jsWriter.startProperty("images");
          jsWriter.startArray();

          for (Iterator<String> itImg = urlFetcher.getThumbNails()
              .iterator(); itImg.hasNext();) {
            jsWriter.startArrayItem();
            jsWriter.outStringLiteral(itImg.next());
            jsWriter.endArrayItem();
          }
          jsWriter.endArray();

          jsWriter.endProperty();

          jsWriter.startProperty("opengraph");
          if (urlFetcher.getOpenGraph().size() > 0) {

            jsWriter.startObject();

            for (Iterator<String> itOG = urlFetcher.getOpenGraph()
                .keySet().iterator(); itOG.hasNext();) {
              String strOGTag = itOG.next();
              jsWriter.startProperty(strOGTag);
              jsWriter.outStringLiteral(urlFetcher.getOpenGraph()
                  .get(strOGTag));
              jsWriter.endProperty();
            }
            jsWriter.endObject();
          } else {
            jsWriter.outStringLiteral("");
          }
          jsWriter.endProperty();
          jsWriter.endObject();

          jsWriter.close();
          return;
        } else {
          ErrorJSONBuilder.getInstance().processError2JSON(engine,
              5001, urlFetcher.getError(),
              urlFetcher.getException());
          return;
        }

      }
      ErrorJSONBuilder.getInstance().processError2JSON(engine, 5002,
View Full Code Here

Examples of org.owasp.webscarab.httpclient.URLFetcher

        // presented to the client.
        if (_base.getScheme().equals("https")) {
          _logger.fine("Intercepting SSL connection!");
          X509Certificate baseCrt = null;
          // Connect early so some SSL details can be copied into new cert
          URLFetcher uf = (URLFetcher) hc;
          try {
            uf.connect(_base);
          } catch (IOException ioe) {
            _logger.severe("Could not connect to remote server "
                + _base.toString() + ": " + ioe);
            return;
          }
          baseCrt = uf.getCertificate();
          _logger.log(Level.FINEST, "Certificate: {0}",
              baseCrt == null ? "null" :
              baseCrt.getSubjectX500Principal().getName());
          _sock = negotiateSSL(_sock, _base.getHost(), baseCrt);
          _clientIn = _sock.getInputStream();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.