Class BaseCookieHandler
- java.lang.Object
-
- org.apache.camel.http.base.cookie.BaseCookieHandler
-
- All Implemented Interfaces:
CookieHandler
- Direct Known Subclasses:
ExchangeCookieHandler
,InstanceCookieHandler
public abstract class BaseCookieHandler extends Object implements CookieHandler
A basic implementation of a CamelCookie handler based on the JDK CookieManager.
-
-
Constructor Summary
Constructors Constructor Description BaseCookieHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract CookieManager
getCookieManager(org.apache.camel.Exchange exchange)
CookieStore
getCookieStore(org.apache.camel.Exchange exchange)
Get the CookieStore.Map<String,List<String>>
loadCookies(org.apache.camel.Exchange exchange, URI uri)
Create cookie headers from the stored cookies appropriate for a given URI.void
storeCookies(org.apache.camel.Exchange exchange, URI uri, Map<String,List<String>> headerMap)
Store cookies for a HTTP response in the cookie handler-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.camel.http.base.cookie.CookieHandler
setCookiePolicy
-
-
-
-
Method Detail
-
storeCookies
public void storeCookies(org.apache.camel.Exchange exchange, URI uri, Map<String,List<String>> headerMap) throws IOException
Description copied from interface:CookieHandler
Store cookies for a HTTP response in the cookie handler- Specified by:
storeCookies
in interfaceCookieHandler
- Parameters:
exchange
- the exchangeuri
- the URI of the called HTTP serviceheaderMap
- a map containing the HTTP headers returned by the server- Throws:
IOException
- if the cookies cannot be stored
-
loadCookies
public Map<String,List<String>> loadCookies(org.apache.camel.Exchange exchange, URI uri) throws IOException
Description copied from interface:CookieHandler
Create cookie headers from the stored cookies appropriate for a given URI.- Specified by:
loadCookies
in interfaceCookieHandler
- Parameters:
exchange
- the exchangeuri
- the URI of the called HTTP service- Returns:
- a map containing the cookie headers that can be set to the HTTP request. Only cookies that are supposed to be sent to the URI in question are considered.
- Throws:
IOException
- if the cookies cannot be loaded
-
getCookieStore
public CookieStore getCookieStore(org.apache.camel.Exchange exchange)
Description copied from interface:CookieHandler
Get the CookieStore. This method can be used if the is using a CookieHandler by itself.- Specified by:
getCookieStore
in interfaceCookieHandler
- Parameters:
exchange
- the exchange- Returns:
- the CookieStore
-
getCookieManager
protected abstract CookieManager getCookieManager(org.apache.camel.Exchange exchange)
-
-