|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.httpclient.protocol.Protocol
public class Protocol
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 );
Constructor Summary | |
---|---|
Protocol(String scheme,
ProtocolSocketFactory factory,
int defaultPort)
Constructs a new Protocol. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Return true if the specified object equals this object. |
int |
getDefaultPort()
Returns the defaultPort. |
static Protocol |
getProtocol(String id)
Gets the protocol with the given ID. |
String |
getScheme()
Returns the scheme. |
ProtocolSocketFactory |
getSocketFactory()
Returns the socketFactory. |
int |
hashCode()
Return a hash code for this object |
boolean |
isSecure()
Returns true if this protocol is secure |
static void |
registerProtocol(String id,
Protocol protocol)
Registers a new protocol with the given identifier. |
int |
resolvePort(int port)
Resolves the correct port for this protocol. |
String |
toString()
Return a string representation of this object. |
static void |
unregisterProtocol(String id)
Unregisters the protocol with the given ID. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Protocol(String scheme, ProtocolSocketFactory factory, int defaultPort)
factory
.
scheme
- the scheme (e.g. http, https)factory
- the factory for creating sockets for communication using
this protocoldefaultPort
- the port this protocol defaults toMethod Detail |
---|
public static void registerProtocol(String id, Protocol protocol)
id
- the identifier for this protocolprotocol
- the protocol to registergetProtocol(String)
public static void unregisterProtocol(String id)
id
- the ID of the protocol to removepublic static Protocol getProtocol(String id) throws IllegalStateException
id
- the protocol ID
IllegalStateException
- if a protocol with the ID cannot be foundpublic int getDefaultPort()
public ProtocolSocketFactory getSocketFactory()
public String getScheme()
public boolean isSecure()
public int resolvePort(int port)
port
- the port to be resolved
public String toString()
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
obj
- The object to compare against.
public int hashCode()
hashCode
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |