org.apache.http.conn.scheme
Class SchemeRegistry

java.lang.Object
  extended by org.apache.http.conn.scheme.SchemeRegistry

public final class SchemeRegistry
extends java.lang.Object

A set of supported protocol schemes. Schemes are identified by lowercase names.

Since:
4.0
Version:
$Revision: 648356 $ $Date: 2008-04-15 18:57:53 +0100 (Tue, 15 Apr 2008) $
Author:
Roland Weber

Constructor Summary
SchemeRegistry()
          Creates a new, empty scheme registry.
 
Method Summary
 Scheme get(java.lang.String name)
          Obtains a scheme by name, if registered.
 Scheme getScheme(org.apache.http.HttpHost host)
          Obtains the scheme for a host.
 Scheme getScheme(java.lang.String name)
          Obtains a scheme by name.
 java.util.List<java.lang.String> getSchemeNames()
          Obtains the names of the registered schemes in their default order.
 Scheme register(Scheme sch)
          Registers a scheme.
 void setItems(java.util.Map<java.lang.String,Scheme> map)
          Populates the internal collection of registered protocol schemes with the content of the map passed as a parameter.
 Scheme unregister(java.lang.String name)
          Unregisters a scheme.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemeRegistry

public SchemeRegistry()
Creates a new, empty scheme registry.

Method Detail

getScheme

public final Scheme getScheme(java.lang.String name)
Obtains a scheme by name.

Parameters:
name - the name of the scheme to look up (in lowercase)
Returns:
the scheme, never null
Throws:
java.lang.IllegalStateException - if the scheme with the given name is not registered

getScheme

public final Scheme getScheme(org.apache.http.HttpHost host)
Obtains the scheme for a host. Convenience method for getScheme(host.getSchemeName())

Parameters:
host - the host for which to obtain the scheme
Returns:
the scheme for the given host, never null
Throws:
java.lang.IllegalStateException - if a scheme with the respective name is not registered

get

public final Scheme get(java.lang.String name)
Obtains a scheme by name, if registered.

Parameters:
name - the name of the scheme to look up (in lowercase)
Returns:
the scheme, or null if there is none by this name

register

public final Scheme register(Scheme sch)
Registers a scheme. The scheme can later be retrieved by its name using getScheme or get.

Parameters:
sch - the scheme to register
Returns:
the scheme previously registered with that name, or null if none was registered

unregister

public final Scheme unregister(java.lang.String name)
Unregisters a scheme.

Parameters:
name - the name of the scheme to unregister (in lowercase)
Returns:
the unregistered scheme, or null if there was none

getSchemeNames

public final java.util.List<java.lang.String> getSchemeNames()
Obtains the names of the registered schemes in their default order.

Returns:
List containing registered scheme names.

setItems

public void setItems(java.util.Map<java.lang.String,Scheme> map)
Populates the internal collection of registered protocol schemes with the content of the map passed as a parameter.

Parameters:
map - protocol schemes


Copyright © 1999-2008 Apache Software Foundation. All Rights Reserved.