java.lang.Object
edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.HostConfiguration
edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.contrib.ssl.HostConfigurationWithStickyProtocol
All Implemented Interfaces:
Cloneable

public class HostConfigurationWithStickyProtocol extends HostConfiguration
A kind of HostConfiguration that can retain its Protocol when its host name or port changes. HttpClient may clone its HostConfigurationWithStickyProtocol and change the host URL, without changing the specialized Protocol.

This is useful for integrating a specialized Protocol or SocketFactory; for example, a SecureSocketFactory that authenticates via SSL. Use HttpClient.setHostConfiguration to install a HostConfigurationWithStickyProtocol that contains the specialized Protocol or SocketFactory.

An alternative is to use Protocol.registerProtocol to register a specialized Protocol. But that has drawbacks: it makes it hard to integrate modules (e.g. web applications in a servlet container) with different strategies, because they share the specialized Protocol (Protocol.PROTOCOLS is static). Also, it can't handle multiple socket factories for the same host and port, since the URL path isn't a parameter to Protocol.getProtocol or socket factory methods.

  • Constructor Details

    • HostConfigurationWithStickyProtocol

      public HostConfigurationWithStickyProtocol()
    • HostConfigurationWithStickyProtocol

      public HostConfigurationWithStickyProtocol(HostConfiguration hostConfiguration)
  • Method Details

    • clone

      public Object clone()
      Overrides:
      clone in class HostConfiguration
      See Also:
    • setHost

      public void setHost(String host, int port, String scheme)
      Description copied from class: HostConfiguration
      Sets the given host, port and protocol
      Overrides:
      setHost in class HostConfiguration
      Parameters:
      host - the host(IP or DNS name)
      port - The port
      scheme - The protocol.
    • getNewProtocol

      protected Protocol getNewProtocol(String host, int port, String scheme)
      Select a Protocol to be used for the given host, port and scheme. The current Protocol may be selected, if appropriate. This method need not be thread-safe; the caller must synchronize if necessary.

      This implementation returns the current Protocol if it has the given scheme; otherwise it returns the Protocol registered for that scheme.