|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.Scheme
public class Scheme
A class to encapsulate the specifics of a protocol scheme. This class also provides the ability to customize the set and characteristics of the schemes 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:
Scheme myHTTPS = new Scheme( "https", new MySSLSocketFactory(), 443 ); Scheme.registerScheme( "https", myHTTPS );
Constructor Summary | |
---|---|
Scheme(java.lang.String name,
SocketFactory factory,
int defaultPort)
Constructs a new Protocol. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Return true if the specified object equals this object. |
int |
getDefaultPort()
Returns the defaultPort. |
java.lang.String |
getName()
Returns the scheme. |
static Scheme |
getScheme(java.lang.String id)
Gets the scheme with the given ID. |
SocketFactory |
getSocketFactory()
Returns the socketFactory. |
int |
hashCode()
Return a hash code for this object |
boolean |
isSecure()
Returns true if this scheme is secure |
static void |
registerScheme(java.lang.String id,
Scheme scheme)
Registers a new scheme with the given identifier. |
int |
resolvePort(int port)
Resolves the correct port for this scheme. |
java.lang.String |
toString()
Return a string representation of this object. |
static void |
unregisterScheme(java.lang.String id)
Unregisters the scheme with the given ID. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Scheme(java.lang.String name, SocketFactory factory, int defaultPort)
factory
.
name
- the scheme name (e.g. http, https)factory
- the factory for creating sockets for communication using
this schemedefaultPort
- the port this scheme defaults toMethod Detail |
---|
public static void registerScheme(java.lang.String id, Scheme scheme)
id
- the identifier for this schemescheme
- the scheme to registergetScheme(String)
public static void unregisterScheme(java.lang.String id)
id
- the ID of the scheme to removepublic static Scheme getScheme(java.lang.String id) throws java.lang.IllegalStateException
id
- the scheme ID
java.lang.IllegalStateException
- if a scheme with the ID cannot be foundpublic int getDefaultPort()
public SocketFactory getSocketFactory()
public java.lang.String getName()
public boolean isSecure()
public int resolvePort(int port)
port
- the port to be resolved
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare against.
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |