Class Protocol
- java.lang.Object
-
- org.apache.commons.httpclient.protocol.Protocol
-
@Deprecated public class Protocol extends java.lang.Object
Deprecated.Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.A class to encapsulate the specifics of a protocol. This class class also provides the ability to customize the set and characteristics of the protocols used.One use case for modifying the default set of protocols would be to set a custom SSL socket factory. This would look something like the following:
Protocol myHTTPS = new Protocol( "https", new MySSLSocketFactory(), 443 ); Protocol.registerProtocol( "https", myHTTPS );
- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description Protocol(java.lang.String scheme, ProtocolSocketFactory factory, int defaultPort)
Deprecated.Constructs a new Protocol.Protocol(java.lang.String scheme, SecureProtocolSocketFactory factory, int defaultPort)
Deprecated.Use the constructor that uses ProtocolSocketFactory, this version of the constructor is only kept for backwards API compatibility.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Deprecated.Return true if the specified object equals this object.int
getDefaultPort()
Deprecated.Returns the defaultPort.static Protocol
getProtocol(java.lang.String id)
Deprecated.Gets the protocol with the given ID.java.lang.String
getScheme()
Deprecated.Returns the scheme.ProtocolSocketFactory
getSocketFactory()
Deprecated.Returns the socketFactory.int
hashCode()
Deprecated.Return a hash code for this objectboolean
isSecure()
Deprecated.Returns true if this protocol is securestatic void
registerProtocol(java.lang.String id, Protocol protocol)
Deprecated.Registers a new protocol with the given identifier.int
resolvePort(int port)
Deprecated.Resolves the correct port for this protocol.java.lang.String
toString()
Deprecated.Return a string representation of this object.static void
unregisterProtocol(java.lang.String id)
Deprecated.Unregisters the protocol with the given ID.
-
-
-
Constructor Detail
-
Protocol
public Protocol(java.lang.String scheme, ProtocolSocketFactory factory, int defaultPort)
Deprecated.Constructs a new Protocol. Whether the created protocol is secure depends on the class offactory
.- Parameters:
scheme
- the scheme (e.g. http, https)factory
- the factory for creating sockets for communication using this protocoldefaultPort
- the port this protocol defaults to
-
Protocol
public Protocol(java.lang.String scheme, SecureProtocolSocketFactory factory, int defaultPort)
Deprecated.Use the constructor that uses ProtocolSocketFactory, this version of the constructor is only kept for backwards API compatibility.Constructs a new Protocol. Whether the created protocol is secure depends on the class offactory
.- Parameters:
scheme
- the scheme (e.g. http, https)factory
- the factory for creating sockets for communication using this protocoldefaultPort
- the port this protocol defaults to
-
-
Method Detail
-
registerProtocol
public static void registerProtocol(java.lang.String id, Protocol protocol)
Deprecated.Registers a new protocol with the given identifier. If a protocol with the given ID already exists it will be overridden. This ID is the same one used to retrieve the protocol from getProtocol(String).- Parameters:
id
- the identifier for this protocolprotocol
- the protocol to register- See Also:
getProtocol(String)
-
unregisterProtocol
public static void unregisterProtocol(java.lang.String id)
Deprecated.Unregisters the protocol with the given ID.- Parameters:
id
- the ID of the protocol to remove
-
getProtocol
public static Protocol getProtocol(java.lang.String id) throws java.lang.IllegalStateException
Deprecated.Gets the protocol with the given ID.- Parameters:
id
- the protocol ID- Returns:
- Protocol a protocol
- Throws:
java.lang.IllegalStateException
- if a protocol with the ID cannot be found
-
getDefaultPort
public int getDefaultPort()
Deprecated.Returns the defaultPort.- Returns:
- int
-
getSocketFactory
public ProtocolSocketFactory getSocketFactory()
Deprecated.Returns the socketFactory. If secure the factory is a SecureProtocolSocketFactory.- Returns:
- SocketFactory
-
getScheme
public java.lang.String getScheme()
Deprecated.Returns the scheme.- Returns:
- The scheme
-
isSecure
public boolean isSecure()
Deprecated.Returns true if this protocol is secure- Returns:
- true if this protocol is secure
-
resolvePort
public int resolvePort(int port)
Deprecated.Resolves the correct port for this protocol. Returns the given port if valid or the default port otherwise.- Parameters:
port
- the port to be resolved- Returns:
- the given port or the defaultPort
-
toString
public java.lang.String toString()
Deprecated.Return a string representation of this object.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this object.
-
equals
public boolean equals(java.lang.Object obj)
Deprecated.Return true if the specified object equals this object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- The object to compare against.- Returns:
- true if the objects are equal.
-
hashCode
public int hashCode()
Deprecated.Return a hash code for this object- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hash code.
-
-