Package org.apache.http.conn.scheme
Class SchemeRegistry
java.lang.Object
org.apache.http.conn.scheme.SchemeRegistry
public final class SchemeRegistry extends Object
A set of supported protocol
schemes.
Schemes are identified by lowercase names.- Since:
- 4.0
- Version:
- $Revision: 648356 $ $Date: 2008-04-15 10:57:53 -0700 (Tue, 15 Apr 2008) $
- Author:
- Roland Weber
-
Constructor Summary
Constructors Constructor Description SchemeRegistry()Creates a new, empty scheme registry. -
Method Summary
Modifier and Type Method Description Schemeget(String name)Obtains a scheme by name, if registered.SchemegetScheme(String name)Obtains a scheme by name.SchemegetScheme(HttpHost host)Obtains the scheme for a host.List<String>getSchemeNames()Obtains the names of the registered schemes in their default order.Schemeregister(Scheme sch)Registers a scheme.voidsetItems(Map<String,Scheme> map)Populates the internal collection of registeredprotocol schemeswith the content of the map passed as a parameter.Schemeunregister(String name)Unregisters a scheme.
-
Constructor Details
-
SchemeRegistry
public SchemeRegistry()Creates a new, empty scheme registry.
-
-
Method Details
-
getScheme
Obtains a scheme by name.- Parameters:
name- the name of the scheme to look up (in lowercase)- Returns:
- the scheme, never
null - Throws:
IllegalStateException- if the scheme with the given name is not registered
-
getScheme
Obtains the scheme for a host. Convenience method forgetScheme(host.getSchemeName())- Parameters:
host- the host for which to obtain the scheme- Returns:
- the scheme for the given host, never
null - Throws:
IllegalStateException- if a scheme with the respective name is not registered
-
get
Obtains a scheme by name, if registered.- Parameters:
name- the name of the scheme to look up (in lowercase)- Returns:
- the scheme, or
nullif there is none by this name
-
register
- Parameters:
sch- the scheme to register- Returns:
- the scheme previously registered with that name, or
nullif none was registered
-
unregister
Unregisters a scheme.- Parameters:
name- the name of the scheme to unregister (in lowercase)- Returns:
- the unregistered scheme, or
nullif there was none
-
getSchemeNames
Obtains the names of the registered schemes in their default order.- Returns:
- List containing registered scheme names.
-
setItems
Populates the internal collection of registeredprotocol schemeswith the content of the map passed as a parameter.- Parameters:
map- protocol schemes
-