【发布时间】:2019-02-18 22:56:07
【问题描述】:
我有一个简单的 http 邮政编码。我有一些基本问题。
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Authorization", "Basic username:password");
httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded");
httpPost.setEntity(entity);
CloseableHttpResponse response = httpClient.execute(httpPost);
httpClient.close();
是否需要为每个发布请求指定授权?一旦为第一个请求建立连接,有没有办法为后续的发布请求重用授权凭证?服务器是否在一段时间内保持特定客户端的授权处于活动状态?
【问题讨论】:
标签: java apache https apache-httpclient-4.x