| java.lang.Object org.apache.commons.httpclient.protocol.Protocol
Protocol | public class Protocol (Code) | | 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 );
author: Michael Becke author: Jeff Dever author: Mike Bowler since: 2.0 |
Protocol | public Protocol(String scheme, ProtocolSocketFactory factory, int defaultPort)(Code) | | Constructs a new Protocol. Whether the created protocol is secure depends on
the class of factory .
Parameters: scheme - the scheme (e.g. http, https) Parameters: factory - the factory for creating sockets for communication usingthis protocol Parameters: defaultPort - the port this protocol defaults to |
Protocol | public Protocol(String scheme, SecureProtocolSocketFactory factory, int defaultPort)(Code) | | Constructs a new Protocol. Whether the created protocol is secure depends on
the class of factory .
Parameters: scheme - the scheme (e.g. http, https) Parameters: factory - the factory for creating sockets for communication usingthis protocol Parameters: defaultPort - the port this protocol defaults to |
equals | public boolean equals(Object obj)(Code) | | Return true if the specified object equals this object.
Parameters: obj - The object to compare against. true if the objects are equal. |
getDefaultPort | public int getDefaultPort()(Code) | | Returns the defaultPort.
int |
getScheme | public String getScheme()(Code) | | Returns the scheme.
The scheme |
getSocketFactory | public ProtocolSocketFactory getSocketFactory()(Code) | | Returns the socketFactory. If secure the factory is a
SecureProtocolSocketFactory.
SocketFactory |
hashCode | public int hashCode()(Code) | | Return a hash code for this object
The hash code. |
isSecure | public boolean isSecure()(Code) | | Returns true if this protocol is secure
true if this protocol is secure |
registerProtocol | public static void registerProtocol(String id, Protocol protocol)(Code) | | 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 protocol Parameters: protocol - the protocol to register See Also: Protocol.getProtocol(String) |
resolvePort | public int resolvePort(int port)(Code) | | 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 the given port or the defaultPort |
toString | public String toString()(Code) | | Return a string representation of this object.
a string representation of this object. |
unregisterProtocol | public static void unregisterProtocol(String id)(Code) | | Unregisters the protocol with the given ID.
Parameters: id - the ID of the protocol to remove |
|
|