Package sun.net.www.http

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


        ServerSocket ss = new ServerSocket(0);

        URL url = new URL("http://localhost:" + ss.getLocalPort());

        HttpClient c = HttpClient.New(url);

        if (!c.getURLFile().equals("/")) {
            throw new Exception("Implicit filename in URL " +
                                url.toString() + " is not '/'");
        }
    }
View Full Code Here

            System.setSecurityManager(security);
        }

        URL url1 = new URL("http://localhost:" + ss.getLocalPort());

        HttpClient c1 = HttpClient.New(url1);

        boolean keepAlive = c1.isKeepingAlive();

        ss.close();
    }
View Full Code Here

public class GetProxyPort {
    public static void main(String[] args) throws Exception {
        ServerSocket ss = new ServerSocket(0);
        URL myURL = new URL("http://localhost:" + ss.getLocalPort());
        HttpClient httpC = new HttpClient(myURL, null, -1);
        int port = httpC.getProxyPortUsed();
    }
View Full Code Here

    OpenServer() throws Exception {

        ServerSocket ss = new ServerSocket(0);

        URL myURL = new URL("http://localhost:" + ss.getLocalPort());
        HttpClient httpC = new HttpClient(myURL, null, -1);

        ss.close();
    }
View Full Code Here

        int cvIdx = 0;
        if (clientVector == null || (cvIdx = clientVector.size()) == 0) {
            logger.fine("No connection in cache for " + url + ".");
            return null;
        }
        HttpClient ret = clientVector.get(--cvIdx);
        clientVector.remove(cvIdx);
        logger.finest("Obtained " + ret + " from cache.");
        return ret;
    }
View Full Code Here

TOP

Related Classes of sun.net.www.http.HttpClient

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.