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
Modifier and TypeMethodDescriptiongetCookieStore(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.voidsetCookiePolicy(CookiePolicy cookiePolicy) Define a CookiePolicy for cookies stored by this CookieHandlervoidStore cookies for a HTTP response in the cookie handler
-
Method Details
-
storeCookies
void storeCookies(org.apache.camel.Exchange exchange, URI uri, Map<String, List<String>> headerMap) throws IOExceptionStore 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
Get the CookieStore. This method can be used if the is using a CookieHandler by itself.- Parameters:
exchange- the exchange- Returns:
- the CookieStore
-
setCookiePolicy
Define a CookiePolicy for cookies stored by this CookieHandler- Parameters:
cookiePolicy- the CookiePolicy
-