Apama 10.15.0 | Connecting Apama Applications to External Components | Standard Connectivity Plug-ins | The HTTP Client Transport Connectivity Plug-in | Mapping events between EPL and HTTP client requests | Dealing with cookies
 
Dealing with cookies
Some HTTP services set cookies and require them to be set in further requests.
When the configuration option cookieJar is true (default), cookies received from the server are stored in memory and added to subsequent outgoing requests. Cookies forwarded using metadata.http.cookies are honored and not overwritten. The HTTP client also honors additional cookie attributes such as path, expiry and max-age. Expired cookies are automatically removed from the internal cache. See also Configuring the HTTP client transport.
When the configuration option cookieJar is false and if you need to take a specific cookie in a response and return it in future requests, you need to map it out into a field in the response event, and then map it back from future request events. The HTTP client stores cookies in metadata.http.cookies.keyname entries. In requests, the HTTP client reads all of the metadata.http.cookies entries and combines them into a single HTTP Cookies header to send to the server. In responses, the HTTP client takes any number of HTTP Set-Cookie headers and turns them into corresponding metadata.http.cookies entries.