Package org.apache.http.cookie
Class CookieSpecRegistry
java.lang.Object
org.apache.http.cookie.CookieSpecRegistry
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
- Author:
- Oleg Kalnichevski, Mike Bowler
-
Constructor Summary
Constructors Constructor Description CookieSpecRegistry() -
Method Summary
Modifier and Type Method Description CookieSpecgetCookieSpec(String name)Gets thecookie specificationwith the given name.CookieSpecgetCookieSpec(String name, HttpParams params)Gets thecookie specificationwith the given ID.List<String>getSpecNames()Obtains a list containing names of all registeredcookie specsin their default order.voidregister(String name, CookieSpecFactory factory)Registers aCookieSpecFactorywith the given identifier.voidsetItems(Map<String,CookieSpecFactory> map)Populates the internal collection of registeredcookie specswith the content of the map passed as a parameter.voidunregister(String id)Unregisters theCookieSpecFactorywith the given ID.
-
Constructor Details
-
CookieSpecRegistry
public CookieSpecRegistry()
-
-
Method Details
-
register
Registers aCookieSpecFactorywith the given identifier. If a specification with the given name already exists it will be overridden. This nameis the same one used to retrieve theCookieSpecFactoryfromgetCookieSpec(String).- Parameters:
name- the identifier for this specificationfactory- theCookieSpecFactoryclass to register- See Also:
getCookieSpec(String)
-
unregister
Unregisters theCookieSpecFactorywith the given ID.- Parameters:
id- the identifier of thecookie specificationto unregister
-
getCookieSpec
Gets thecookie specificationwith the given ID.- Parameters:
name- thecookie specificationidentifierparams- theHTTP parametersfor the cookie specification.- Returns:
cookie specification- Throws:
IllegalStateException- if a policy with the given name cannot be found
-
getCookieSpec
Gets thecookie specificationwith the given name.- Parameters:
name- thecookie specificationidentifier- Returns:
cookie specification- Throws:
IllegalStateException- if a policy with the given name cannot be found
-
getSpecNames
Obtains a list containing names of all registeredcookie specsin 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
Populates the internal collection of registeredcookie specswith the content of the map passed as a parameter.- Parameters:
map- cookie specs
-