Examples of HttpClient


Examples of org.xlightweb.client.HttpClient

        @Override
        public void run() {

          running.incrementAndGet();
          try {
            HttpClient httpClient = new HttpClient();
            httpClient.setMaxRetries(0);

            for (int j = 0; j< 1000; j++) {
              IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
             
              Assert.assertEquals(200, response.getStatus());
              Assert.assertEquals("OK", response.getBlockingBody().readString());
            }
           
            httpClient.close();

           
          } catch (Exception e) {
            e.printStackTrace();
            errors.add(e.toString());
View Full Code Here

Examples of org.xlightweb.client.HttpClient

        @Override
        public void run() {

          running.incrementAndGet();
          try {
            HttpClient httpClient = new HttpClient();
            httpClient.setMaxRetries(0);

            for (int j = 0; j< 1000; j++) {
              GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/");
              IHttpResponse response = httpClient.call(request);
             
              Assert.assertEquals(200, response.getStatus());
              Assert.assertEquals("OK", response.getBlockingBody().readString());
            }
           
            httpClient.close();
           
           
          } catch (Exception e) {
            e.printStackTrace();
            errors.add(e.toString());
View Full Code Here

Examples of org.xlightweb.client.HttpClient

        @Override
        public void run() {

          running.incrementAndGet();
          try {
            HttpClient httpClient = new HttpClient();
            httpClient.setMaxRetries(0);

            for (int j = 0; j< 1000; j++) {
              GetRequest request = new GetRequest("http://localhost:" + server.getLocalPort() + "/");
              IHttpResponse response = httpClient.call(request);
             
              Assert.assertEquals(200, response.getStatus());
              Assert.assertEquals("OK", response.getBlockingBody().readString());
            }
           
            httpClient.close();

           
          } catch (Exception e) {
            e.printStackTrace();
            errors.add(e.toString());
View Full Code Here

Examples of org.xlightweb.client.HttpClient

        @Override
        public void run() {

          running.incrementAndGet();
          try {
            HttpClient httpClient = new HttpClient();
            httpClient.setMaxRetries(0);

            for (int j = 0; j< 1000; j++) {
              GetRequest request = new GetRequest("http://localhost:" + webContainer.getLocalPort() + "/");
              IHttpResponse response = httpClient.call(request);
             
              if (response.getStatus() != 200) {
                System.out.println("status 200 expected. Got " + response);
                errors.add("status 200 expected. Got " + response.getStatus());
              }
             
              String body = response.getBlockingBody().readString();
              if (!body.equals("OK")) {
                System.out.println("content OK expected. Got " + body);
              }
            }
           
            httpClient.close();

           
          } catch (Exception e) {
            e.printStackTrace();
            errors.add(e.toString());
View Full Code Here

Examples of org.xlightweb.client.HttpClient

                @Override
                public void run() {

                    running.incrementAndGet();
                    try {
                        HttpClient httpClient = new HttpClient();

                        for (int j = 0; j< 100; j++) {
                            GetRequest request = new GetRequest("http://localhost:" + webContainer.getLocalPort() + "/");
                            IHttpResponse response = httpClient.call(request);
                           
                            if (response.getStatus() != 200) {
                                System.out.println("status 200 expected. Got " + response);
                                errors.add("status 200 expected. Got " + response.getStatus());
                            }
                           
                            String body = response.getBlockingBody().readString();
                            if (!body.equals("OK")) {
                                System.out.println("content OK expected. Got " + body);
                            }
                        }
                       
                        httpClient.close();

                       
                    } catch (Exception e) {
                        e.printStackTrace();
                        errors.add(e.toString());
View Full Code Here

Examples of org.xlightweb.client.HttpClient

                @Override
                public void run() {

                    running.incrementAndGet();
                    try {
                        HttpClient httpClient = new HttpClient();
                        httpClient.setMaxRetries(0);

                        for (int j = 0; j< 1000; j++) {
                            GetRequest request = new GetRequest("http://localhost:" + webContainer.getLocalPort() + "/");
                            IHttpResponse response = httpClient.call(request);
                           
                            if (response.getStatus() != 200) {
                                System.out.println("status 200 expected. Got " + response);
                                errors.add("status 200 expected. Got " + response.getStatus());
                            }
                           
                            String body = response.getBlockingBody().readString();
                            if (!body.equals("OK")) {
                                System.out.println("content OK expected. Got " + body);
                            }
                        }
                       
                        httpClient.close();

                       
                    } catch (Exception e) {
                        e.printStackTrace();
                        errors.add(e.toString());
View Full Code Here

Examples of our.apache.commons.httpclient.HttpClient

     * @throws IOException If there is a problem in making the request.
     */
    public int executeRequest(HttpMethod method,
                              String fullURL) throws IOException {
        // Create a client for the connection
        HttpClient client = new HttpClient();

        // Timeout connections after 15 seconds
        client.setConnectionTimeout(15000);

        // Timeout connected sockets after 30 seconds
        client.setTimeout(30000);

        // Execute the method.
        int statusCode = -1;
        int attempt = 0;

        // Retry the request up to 3 times
        while ((statusCode == -1) && (attempt < 3)) {
            statusCode = client.executeMethod(method);
            attempt++;
        }

        // If the status code is still -1 then ran out of retries to
        // connect to the server
View Full Code Here

Examples of railo.runtime.net.http.HTTPClient

    public static Object doWebService(PageContext pc,String wsdlUrl,String username,String password, ProxyData proxy) throws PageException {
      // TODO CF8 impl. all new attributes for wsdl
      return new RPCClient(wsdlUrl,username,password,proxy);
    }
    public static Object doHTTP(PageContext pc,String httpUrl) throws PageException {
      return new HTTPClient(httpUrl,null,null,null);
    }
View Full Code Here

Examples of sun.net.www.http.HttpClient

             * indication that the application doesn't intend to access
             * this http server for a while.
             */

            if (inputStream != null) {
                HttpClient hc = http;

                // un-synchronized
                boolean ka = hc.isKeepingAlive();

                try {
                    inputStream.close();
                } catch (IOException ioe) { }

                // if the connection is persistent it may have been closed
                // or returned to the keep-alive cache. If it's been returned
                // to the keep-alive cache then we would like to close it
                // but it may have been allocated

                if (ka) {
                    hc.closeIdleConnection();
                }


            } else {
                // We are deliberatly being disconnected so HttpClient
View Full Code Here

Examples of xgenerator.util.HttpClient

   * @author <a href="mailto:shushanlee@msn.com">liss</a>
   * @param e
   */
  public void updateActionPerformed(ActionEvent e) {
    try {
      HttpClient httpClient = new HttpClient();
      String requestUrl = "http://liss.iteye.com/";
      String responseEncoding = "UTF-8";
      //System.out.println(httpClient.doGet(requestUrl, responseEncoding));
      if(true) {
        JOptionPane.showMessageDialog(ui, "恭喜!\n你的XGenerator已经是最新版本。", "XGenerator在线升级", JOptionPane.INFORMATION_MESSAGE);
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.