Package org.apache.commons.httpclient.protocol

Examples of org.apache.commons.httpclient.protocol.Protocol


        // Append method name
        buf.append(name);
        buf.append(" ");
        // Absolute or relative URL?
        if (!connection.isTransparent()) {
            Protocol protocol = connection.getProtocol();
            buf.append(protocol.getScheme().toLowerCase());
            buf.append("://");
            buf.append(connection.getHost());
            if ((connection.getPort() != -1)
                && (connection.getPort() != protocol.getDefaultPort())
            ) {
                buf.append(":");
                buf.append(connection.getPort());
            }
        }
View Full Code Here


        // we must set the host to a secure destination or the CONNECT method
        // will not be used
        client.getHostConfiguration().setHost(
            "notARealHost",
            1234,
            new Protocol(
                "https",
                (ProtocolSocketFactory)new FakeSecureProtocolSocketFactory(),
                443)
        );
       
View Full Code Here

    private HttpClient createAndInitHttpClient(String characterEncoding, boolean selfSignedSSL) {
       
        if (selfSignedSSL) {
            Protocol.registerProtocol("https",
                    new Protocol("https", new EasySSLProtocolSocketFactory(), 443));
        }
       
        HttpClient httpClient = new HttpClient();
        httpClient.getParams().setBooleanParameter("http.protocol.allow-circular-redirects", true);
        httpClient.getParams().setConnectionManagerTimeout(CONNECTION_TIMEOUT_INTERVAL);
View Full Code Here

        // Append method name
        buf.append(name);
        buf.append(" ");
        // Absolute or relative URL?
        if (!connection.isTransparent()) {
            Protocol protocol = connection.getProtocol();
            buf.append(protocol.getScheme().toLowerCase());
            buf.append("://");
            buf.append(connection.getHost());
            if ((connection.getPort() != -1)
                && (connection.getPort() != protocol.getDefaultPort())
            ) {
                buf.append(":");
                buf.append(connection.getPort());
            }
        }
View Full Code Here

        catch ( final ParameterException e )
        {
            return; // this is ok, means no custom socket factory
        }

        final Protocol protocol =
            new Protocol(
                HTTPS,
                ( SecureProtocolSocketFactory ) getInstance( factoryName ),
                443
            );
        Protocol.registerProtocol( HTTPS, protocol );
View Full Code Here

     * Set the given host. Uses the default protocol("http") and its port.
     *
     * @param host The host(IP or DNS name).
     */
    public synchronized void setHost(String host) {
        Protocol defaultProtocol = Protocol.getProtocol("http");
        setHost(host, null, defaultProtocol.getDefaultPort(), defaultProtocol);
    }
View Full Code Here

        String schema = uri.getScheme();
        if ((schema == null) || (schema.equals("")))
        {
            schema = "http";
        }
        Protocol protocol = Protocol.getProtocol(schema);

        String host = uri.getHost();
        int port = uri.getPort();
       
        HostConfiguration hc = new HostConfiguration();
View Full Code Here

                    case 'd':
                        client.setDebug(Client.DEBUG_ON);
                        break;
                    case 's':
                        Protocol.registerProtocol("https",
                                                  new Protocol("https",
                                                               new EasySSLProtocolSocketFactory(),
                                                               443));
                        break;
                    default:
                        System.exit(-1);
View Full Code Here

        // is this an absolute path?
        if (absolutePathOrURL.startsWith("/")) {

            // yes - get the protocol to start the URL with the appropriate scheme.
            Protocol protocol = conn.getProtocol();
            StringBuffer bufDest = new StringBuffer(protocol.getScheme());
            bufDest.append("://").append(conn.getHost());

            // only add in the port if it is not the default port.
            if (conn.getPort() != protocol.getDefaultPort()) {
                bufDest.append(':').append(conn.getPort());
            }

            // append the path.
            bufDest.append(absolutePathOrURL);
View Full Code Here

        String schema = uri.getScheme();
        if ((schema == null) || (schema.equals("")))
        {
            schema = "http";
        }
        Protocol protocol = Protocol.getProtocol(schema);

        String host = uri.getHost();
        int port = uri.getPort();
       
        HostConfiguration hc = new HostConfiguration();
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.protocol.Protocol

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.