Class BaseCookieHandler
java.lang.Object
org.apache.camel.http.base.cookie.BaseCookieHandler
- All Implemented Interfaces:
CookieHandler
- Direct Known Subclasses:
ExchangeCookieHandler
,InstanceCookieHandler
A basic implementation of a CamelCookie handler based on the JDK CookieManager.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract CookieManager
getCookieManager
(org.apache.camel.Exchange exchange) getCookieStore
(org.apache.camel.Exchange exchange) Get the CookieStore.loadCookies
(org.apache.camel.Exchange exchange, URI uri) Create cookie headers from the stored cookies appropriate for a given URI.void
Store cookies for a HTTP response in the cookie handlerMethods 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
-
Constructor Details
-
BaseCookieHandler
public BaseCookieHandler()
-
-
Method Details
-
storeCookies
public void storeCookies(org.apache.camel.Exchange exchange, URI uri, Map<String, List<String>> headerMap) throws IOExceptionDescription 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
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
-