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

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

    }

    public void testConnTimeoutRelease() {

        // create a custom protocol that will delay for 500 milliseconds
        Protocol testProtocol = new Protocol(
            "timeout",
            new DelayedProtocolSocketFactory(
                500,
                Protocol.getProtocol("http").getSocketFactory()
            ),
View Full Code Here


    public void testConnTimeout() {

        // create a custom protocol that will delay for 500 milliseconds
        Protocol testProtocol = new Protocol(
            "timeout",
            new DelayedProtocolSocketFactory(
                500,
                Protocol.getProtocol("http").getSocketFactory()
            ),
View Full Code Here

  public static void registerFactory(
    SecureProtocolSocketFactory factory,
    int port) {
      Protocol.registerProtocol(
        "https",
        new Protocol(
          "https",
          (ProtocolSocketFactory)factory, port));
  }
View Full Code Here

  private static void registerFactory(
    SimpleSSLProtocolSocketFactory factory,
    int port) {
      Protocol.registerProtocol(
        "https",
        new Protocol(
          "https",
          (ProtocolSocketFactory)factory, port));
  }
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

        if (scheme == null) {   // it may a URI instance or abs_path
            LOG.error("no scheme to start a session");
            throw new IllegalStateException("no scheme to start a session");
        }

        Protocol protocol = Protocol.getProtocol(scheme);

        String userinfo = uri.getUserinfo();
        if (userinfo != null) {
            getState().setCredentials(null,
                    new UsernamePasswordCredentials(userinfo));
View Full Code Here

     */
    public void startSession(URL url) throws IllegalArgumentException {
        LOG.trace("enter HttpClient.startSession(String, int, Credentials, boolean)");

        int port = url.getPort();
        Protocol protocol = Protocol.getProtocol(url.getProtocol());

        hostConfiguration.setHost(url.getHost(), null, port, protocol);
    }
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.