Interface CookieHandler
-
- All Known Implementing Classes:
BaseCookieHandler
,ExchangeCookieHandler
,InstanceCookieHandler
public interface CookieHandler
The interface for cookie handling will allow components to handle cookies for HTTP requests.Note: The defined cookie policies apply. The default is CookiePolicy.ACCEPT_ORIGINAL_SERVER, so cookies will only be handled for fully qualified host names in the URI (not local host names like "myhost" or "localhost").
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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
setCookiePolicy(CookiePolicy cookiePolicy)
Define a CookiePolicy for cookies stored by this CookieHandlervoid
storeCookies(org.apache.camel.Exchange exchange, URI uri, Map<String,List<String>> headerMap)
Store cookies for a HTTP response in the cookie handler
-
-
-
Method Detail
-
storeCookies
void storeCookies(org.apache.camel.Exchange exchange, URI uri, Map<String,List<String>> headerMap) throws IOException
Store cookies for a HTTP response in the cookie handler- 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
Map<String,List<String>> loadCookies(org.apache.camel.Exchange exchange, URI uri) throws IOException
Create cookie headers from the stored cookies appropriate for a given URI.- 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
CookieStore getCookieStore(org.apache.camel.Exchange exchange)
Get the CookieStore. This method can be used if the is using a CookieHandler by itself.- Parameters:
exchange
- the exchange- Returns:
- the CookieStore
-
setCookiePolicy
void setCookiePolicy(CookiePolicy cookiePolicy)
Define a CookiePolicy for cookies stored by this CookieHandler- Parameters:
cookiePolicy
- the CookiePolicy
-
-