org.apache.http.cookie
Class CookieSpecRegistry

java.lang.Object
  extended by org.apache.http.cookie.CookieSpecRegistry

@ThreadSafe
public final class CookieSpecRegistry
extends Object

Cookie specification registry that can be used to obtain the corresponding cookie specification implementation for a given type of type or version of cookie.

Since:
4.0

Constructor Summary
CookieSpecRegistry()
           
 
Method Summary
 CookieSpec getCookieSpec(String name)
          Gets the cookie specification with the given name.
 CookieSpec getCookieSpec(String name, HttpParams params)
          Gets the cookie specification with the given ID.
 List<String> getSpecNames()
          Obtains a list containing names of all registered cookie specs in their default order.
 void register(String name, CookieSpecFactory factory)
          Registers a CookieSpecFactory with the given identifier.
 void setItems(Map<String,CookieSpecFactory> map)
          Populates the internal collection of registered cookie specs with the content of the map passed as a parameter.
 void unregister(String id)
          Unregisters the CookieSpecFactory with the given ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CookieSpecRegistry

public CookieSpecRegistry()
Method Detail

register

public void register(String name,
                     CookieSpecFactory factory)
Registers a CookieSpecFactory with the given identifier. If a specification with the given name already exists it will be overridden. This nameis the same one used to retrieve the CookieSpecFactory from getCookieSpec(String).

Parameters:
name - the identifier for this specification
factory - the CookieSpecFactory class to register
See Also:
getCookieSpec(String)

unregister

public void unregister(String id)
Unregisters the CookieSpecFactory with the given ID.

Parameters:
id - the identifier of the cookie specification to unregister

getCookieSpec

public CookieSpec getCookieSpec(String name,
                                HttpParams params)
                         throws IllegalStateException
Gets the cookie specification with the given ID.

Parameters:
name - the cookie specification identifier
params - the HTTP parameters for the cookie specification.
Returns:
cookie specification
Throws:
IllegalStateException - if a policy with the given name cannot be found

getCookieSpec

public CookieSpec getCookieSpec(String name)
                         throws IllegalStateException
Gets the cookie specification with the given name.

Parameters:
name - the cookie specification identifier
Returns:
cookie specification
Throws:
IllegalStateException - if a policy with the given name cannot be found

getSpecNames

public List<String> getSpecNames()
Obtains a list containing names of all registered cookie specs in their default order. Note that the DEFAULT policy (if present) is likely to be the same as one of the other policies, but does not have to be.

Returns:
list of registered cookie spec names

setItems

public void setItems(Map<String,CookieSpecFactory> map)
Populates the internal collection of registered cookie specs with the content of the map passed as a parameter.

Parameters:
map - cookie specs


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