title: HttpClient how to retrieve rejected cookie
body: <p>I am using resteasy client 3.0.6 and httpclient 4.5.2 and I got following warnings when performing a GET request:</p>
  
  <pre><code>Apr 19, 2018 12:40:18 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
  WARNING: Cookie rejected [MY_COOKIE_IDENTITY="eyJhbGciOiJIUzI1NiIsImtpZCIgOiAiNzE5OTk3ZGQtNjVhZi00OTMwLTgwMjYtYWU3ZjIxZDYyYWI3In0.eyJqdGkiOiIyZjdh...", version:1, domain:psp208.fx.lan, path:/auth/210, expiry:null] Illegal 'path' attribute "/auth/210". Path of origin: "/auth/001"
  Apr 19, 2018 12:40:18 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
  WARNING: Cookie rejected [MY_COOKIE_SESSION="epos210/770a1a6f-1901-4985-8330-5aab4f9febe8/5f45c340-dfb6-466a-8f96-9d5a3cc51643", version:0, domain:psp208.fx.lan, path:/auth/210, expiry:Thu Apr 19 22:40:18 CEST 2018] Illegal 'path' attribute "/auth/210". Path of origin: "/auth/001"
  </code></pre>
  
  <p>but even if they are defined with an illegal path, I want to retrieve them programatically. Currently I am trying to use the following snippet:</p>
  
  <pre><code>ResteasyClient client = new ResteasyClientBuilder().connectionPoolSize(20).httpEngine(apacheHttpClient4Engine).build();
  client.register(new ClientRequestFilter(){
  
      @Override
      public void filter(ClientRequestContext arg0) throws IOException {
          cookies.putAll(arg0.getCookies());
      }
  
  });
  </code></pre>
  
  <p>but the filter is never invoked.</p>
  
  <p>After looking HttpClient documentation I tried creating my own CookieSpecProvider:</p>
  
  <pre><code>Registry&lt;CookieSpecProvider&gt; r = RegistryBuilder.&lt;CookieSpecProvider&gt;create()
      .register("easy", new CookieSpecProvider(){
  
          @Override
          public CookieSpec create(HttpContext arg0) {
              return new BrowserCompatSpec(){
  
                  @Override
                  public void validate(org.apache.http.cookie.Cookie cookie, CookieOrigin origin)
                          throws MalformedCookieException {
  
                      // empty implementation
                  }
  
  
              };
          }
  
      })
  .build();
  </code></pre>
  
  <p>by using this implementation the ClientRequestFilter is invoked but it is returning an empty map of cookies.</p>
  
  <p>My goal is to retrieve the two cookies I get from the response. How can I do it ?</p>
  
  <p>thanks for any help</p>