HttpClient WARNING: Cookie rejected: Illegal domain attribute

前端 未结 7 784
慢半拍i
慢半拍i 2020-12-09 03:36

I\'m using HttpClient latest version (4.x). And right now I\'m trying to do A GET Request. I just posting a Get request.

This is my Code;

public clas         


        
7条回答
  •  执笔经年
    2020-12-09 03:49

    Before httpclient 4.3, this answer in the same page is cool.

    But since httpclient 4.3, API seems changed a lot, following code would work:

    RequestConfig customizedRequestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.BROWSER_COMPATIBILITY).build();
    HttpClientBuilder customizedClientBuilder = HttpClients.custom().setDefaultRequestConfig(customizedRequestConfig);
    CloseableHttpClient client = customizedClientBuilder.build(); // customized client,
    

提交回复
热议问题