I have a problem I can't seem to grasp. My relevant code is
final Builder requestConfigBuilder = RequestConfig.custom();
...
final HttpClientBuilder clientBuilder = HttpClientBuilder.create();
clientBuilder.setDefaultCookieStore();
clientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());
...
If I use this client I get from my builder, I can see all cookies being sent in my request as I would expect. However, adding a cookie spec, like this:
final Builder requestConfigBuilder = RequestConfig.custom();
...
requestConfigBuilder.setCookieSpec(CookieSpecs.DEFAULT); //this causes problems
final HttpClientBuilder clientBuilder = HttpClientBuilder.create();
clientBuilder.setDefaultCookieStore(someCookieStoreVariable);
clientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());
...
I see no cookies being sent in my request. The result is the same no matter which spec I choose from CookieSpecs.
Am I misunderstanding or misusing this, why doesn't this work? Is there some problem with me setting another cookiestore? I do need it for future references so it has to stay.
Check whether cookie domain and path are set properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With