My Axis2 client is somehow sending TWO cookie headers on each POST
request, with slightly different formatting but the same JSESSIONID:
Cookie: JSESSIONID=69C868C8CC13EA14A5E8846FC87E2EB8
Cookie: $Version=0; JSESSIONID=69C868C8CC13EA14A5E8846FC87E2EB8;
$Path=/myservice
This is a problem for me because occasionally my server invalidates the
JSESSIONID I am using if too much time elapses between requests and
fails the operation due to an invalid JSESSIONID. In this case I need
to resend the failed request without any Cookie header, whereupon the
server will create a new session and issue a new JSESSIONID.
I succeeded in getting rid of ONE of the Cookie headers by doing this:
HttpClient httpClient = (HttpClient)
msgCtx.getConfigurationContext()
.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
httpClient.getState().clearCookies();
This gets rid of the Cookie header with the $Version and $Path, but not
the other one. So when I retry the request, I am still sending a Cookie
header with an invalid JSESSIONID. Does anyone know where is this
duplicate cookie header coming from, and how I can get rid of it?