title: OkHttp CookieJar saveFromResponse method
body: <p>I created a simple project which using CookieJar. Now I am trying to understand when saveFromResponse method works. But I see in my logs that loadForRequest works fine, but I doesn't see saveFromResponse logs. Why? At what time of process this method works? Can we use only intercept method if we works with cookies or may be we have a special situation for using CookieJar? </p>
  
  <pre><code> OkHttpClient client = new OkHttpClient.Builder()
                .addInterceptor(new ReceivedCookiesInterceptor())
                .cookieJar(new CookieJar() {
                   private final HashMap&lt;HttpUrl, List&lt;Cookie&gt;&gt; cookieStore = new HashMap&lt;&gt;();
                          @Override
                          public void saveFromResponse(HttpUrl url, List&lt;Cookie&gt; cookies) {
                                      Log.d(TAG,"saveFromResponse");
                                      cookieStore.put(url, cookies);
                          }
                          @Override
                          public List&lt;Cookie&gt; loadForRequest(HttpUrl url) {
                                      Log.d(TAG,"loadForRequest");
                                      List&lt;Cookie&gt; cookies = cookieStore.get(url);
                                      return cookies != null ? cookies : new ArrayList&lt;Cookie&gt;();
                                          }
                                      })
                                      .build();
  
                              Request request = new Request.Builder()
                                      .url("http://www.publicobject.com/helloworld.txt")
                                      .build();
  
                              Response response = client.newCall(request).execute();
  
                              response.body().close();
  </code></pre>