Package HTTPClient

Examples of HTTPClient.HTTPConnection$EstablishConnection


            progressBar.setString("");
            progressBar.setValue(0);
        }

        // create a connection for figuring out what we need to grab
        final HTTPConnection searchConnection = new HTTPConnection(host);

        // prepare a stream to determine the number of pages in the result set
        final String searchUrlPath = "/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=10GN481Z3YQ4S67KNSG2&Operation=ItemSearch&SearchIndex=DVD&ResponseGroup=ItemIds&Keywords=" + keywords;

        // parse the number of results from the stream
View Full Code Here


            this.requestEnqueuer = new RequestEnqueuer();

            this.target.addListEventListener(this.progressBarUpdater);
            this.itemASINs.addListEventListener(requestEnqueuer);

            this.httpConnection = new HTTPConnection(host);
        }
View Full Code Here

      {
        formData[i++] = new NVPair(EnvelopeConstants.F_SESSIONDATA,sessionData);
      }

      // connect and post
      HTTPConnection httpConnection = getHTTPConnection(url);

      HTTPResponse httpResponse;
      if (xmlRqst != null && xmlRqst.length() > MP_FORM_DATA_TRESHOLD)
      {
        // multipart form data (faster?)
        NVPair[] ct_hdr = new NVPair[1];
        byte[] data = Codecs.mpFormDataEncode(formData,null,ct_hdr);
        httpResponse = httpConnection.Post(url.getFile(),data,ct_hdr);
      }
      else
      {
        // urlencoded (slow?)
        httpResponse = httpConnection.Post(url.getFile(),formData);
      }

      if (httpResponse.getStatusCode() >= 200 && httpResponse.getStatusCode() < 300)
      {
        // ok
View Full Code Here

  }

  protected HTTPConnection getHTTPConnection(URL url)
    throws HTTPClient.ProtocolNotSuppException
  {
    HTTPConnection cnx = new HTTPConnection(url);
    if (authorize) cnx.addBasicAuthorization(realm, username, password);
    return cnx;
  }
View Full Code Here

  /* get an HTTPConnection */

        try
        {
      con = new HTTPConnection(getCodeBase());
        }
        catch (Exception e)
        {
            disp = "Error creating HTTPConnection:\n" + e;
            repaint();
View Full Code Here

  }

  URI url = new URI(args[0]);

  DefaultAuthHandler.setAuthorizationPrompter(new MyAuthPrompter(pa_name, pa_pass));
  HTTPConnection con = new HTTPConnection(url);
  HTTPResponse   rsp = con.Head(url.getPathAndQuery());

  int sts = rsp.getStatusCode();
  if (sts < 300)
      System.out.println("No authorization required to access " + url);
  else if (sts >= 400  &&  sts != 401  &&  sts != 407)
View Full Code Here

    } catch (Exception e) {};

    String data = "";

    try {
      HTTPConnection con = new HTTPConnection(host);
      HTTPResponse rsp = con.Get(path);
      // Call getText to block the connection until it gets the whole page.
      rsp.getText();
      byte[] bytes = rsp.getData();

      // Create decoder for ISO-8859-2
View Full Code Here

        final Matcher m = p.matcher(uri);
        if (m.find() == false) {
            throw new IOException(uri);
        }
        final URL url = new URL(uri);
        final HTTPConnection httpConnection = new HTTPConnection(url);
        try {
            final HTTPResponse resp = httpConnection.Get(m.group(1));
            return resp.getText();
        } catch (ModuleException e) {
            throw new IOException(e.toString());
        } catch (ParseException e) {
            throw new IOException(e.toString());
View Full Code Here

TOP

Related Classes of HTTPClient.HTTPConnection$EstablishConnection

Copyright © 2018 www.massapicom. 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.