Package org.apache.http.message

Examples of org.apache.http.message.HttpGet


            request = httppost;
        } else if (cmd.hasOption('i')) {
            HttpHead httphead = new HttpHead(url.getPath());
            request = httphead;
        } else {
            HttpGet httpget = new HttpGet(url.getPath());
            request = httpget;
        }
        if (!keepAlive) {
            request.addHeader(new Header(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE));
        }
View Full Code Here


            for (int i = 0; i < targets.length; i++) {
                if (!conn.isOpen()) {
                    Socket socket = new Socket(host.getHostName(), host.getPort());
                    conn.bind(socket, params);
                }
                HttpGet request = new HttpGet(targets[i]);
                System.out.println(">> Request URI: " + request.getRequestLine().getUri());
                HttpResponse response = httpexecutor.execute(request, conn, context);
                System.out.println("<< Response: " + response.getStatusLine());
                System.out.println(EntityUtils.toString(response.getEntity()));
                System.out.println("==============");
                if (!connStrategy.keepAlive(response, context)) {
View Full Code Here

            context.setAttribute("request-count", new Integer(counter));
            if (counter < 3) {
                System.out.println("--------------");
                System.out.println("Sending request to " + targetHost);
                System.out.println("--------------");
                return new HttpGet("/");
            } else {
                // Return null to terminate the connection
                return null;
            }
        }
View Full Code Here

                context.setAttribute("RES-COUNT", new Integer(0));
            }

            public HttpRequest submitRequest(final HttpContext context) {
                int i = ((Integer) context.getAttribute("REQ-COUNT")).intValue();
                HttpGet get = null;
                if (i < reqNo) {
                    get = new HttpGet("/?" + i);
                    context.setAttribute("REQ-COUNT", new Integer(i + 1));
                }
                return get;
            }
           
View Full Code Here

                context.setAttribute("RES-COUNT", new Integer(0));
            }

            public HttpRequest submitRequest(final HttpContext context) {
                int i = ((Integer) context.getAttribute("REQ-COUNT")).intValue();
                HttpGet get = null;
                if (i < reqNo) {
                    get = new HttpGet("/?" + i);
                    context.setAttribute("REQ-COUNT", new Integer(i + 1));
                }
                return get;
            }
           
View Full Code Here

                if (!conn.isOpen()) {
                    Socket socket = new Socket(host.getHostName(), host.getPort());
                    conn.bind(socket, this.client.getParams());
                }
               
                HttpGet get = new HttpGet("/?" + r);
                HttpResponse response = this.client.execute(get, host, conn);
                byte[] received = EntityUtils.toByteArray(response.getEntity());
                byte[] expected = (byte[]) testData.get(r);
               
                assertEquals(expected.length, received.length);
View Full Code Here

            request = httppost;
        } else if (cmd.hasOption('i')) {
            HttpHead httphead = new HttpHead(url.getPath());
            request = httphead;
        } else {
            HttpGet httpget = new HttpGet(url.getPath());
            request = httpget;
        }
        if (!keepAlive) {
            request.addHeader(new Header(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE));
        }
View Full Code Here

                    "/somewhere%20in%20pampa"};
           
            ConnectionReuseStrategy connStrategy = new DefaultConnectionReuseStrategy();
           
            for (int i = 0; i < targets.length; i++) {
                HttpGet request = new HttpGet(targets[i]);
                System.out.println(">> Request URI: " + request.getRequestLine().getUri());
                HttpResponse response = httpexecutor.execute(request, conn);
                System.out.println("<< Response: " + response.getStatusLine());
                System.out.println(EntityUtils.toString(response.getEntity()));
                System.out.println("==============");
                if (!connStrategy.keepAlive(response)) {
View Full Code Here

                    "/somewhere%20in%20pampa"};
           
            ConnectionReuseStrategy connStrategy = new DefaultConnectionReuseStrategy();
           
            for (int i = 0; i < targets.length; i++) {
                HttpGet request = new HttpGet(targets[i]);
                System.out.println(">> Request URI: " + request.getRequestLine().getUri());
                HttpResponse response = httpexecutor.execute(request, conn);
                System.out.println("<< Response: " + response.getStatusLine());
                System.out.println(EntityUtils.toString(response.getEntity()));
                System.out.println("==============");
                if (!connStrategy.keepAlive(response)) {
View Full Code Here

            request = httppost;
        } else if (cmd.hasOption('i')) {
            HttpHead httphead = new HttpHead(url.getPath());
            request = httphead;
        } else {
            HttpGet httpget = new HttpGet(url.getPath());
            request = httpget;
        }
        if (!keepAlive) {
            request.addHeader(new DefaultHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_CLOSE));
        }
View Full Code Here

TOP

Related Classes of org.apache.http.message.HttpGet

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.