Java 8 HttpClient 4.5用BasicCookiestore处理饼干



我该怎么做?

HttpClientBuilder client = HttpClientBuilder.create();
HttpResponse response = null;
HttpClientContext context = HttpClientContext.create();
BasicCookieStore cookieStore = new BasicCookieStore();
client.setDefaultCookieStore(cookieStore);
response = client.build().execute(get);
cookieStore = context.getCookieStore();

它给了我:Cookiestore无法转换为BasicCookiestore。我不能使用库克iestore界面而不是bashicookiestore,因为在我的其他类中,我显示了"无法实例化的接口"。

我认为铸造会帮助您。

BasicCookieStore cookieStore = (BasicCookieStore) context.getCookieStore();

相关内容

  • 没有找到相关文章

最新更新