사용자 이름/비밀번호가 포함 된 권한 부여 헤더가 특정 문자 집합을 사용할 수 있도록 헤더에 사용할 charset을 지정하는 방법에 대해 httpclient 4.3.3 API를 조회했습니다. UTF-8 또는 iso-8859-1과 같은 사용되지 않는 3.x API는 다음과 같습니다.httpclient 4.3.x에서 작동하지 않는 non-ascii 자격 증명 사용
httpMethodInstance.getParams().setHttpElementCharset("iso-8859-1");
4.3.3의 해당 API는 ConnectionConfig에 있습니다. 내가
HttpClientBuilder builder = HttpClientBuilder.create();
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
builder.setDefaultCredentialsProvider(credentialsProvider);
ConnectionConfig connectionConfig = ConnectionConfig.custom()
.setCharset(Charset.forName("iso-8859-1")).build();
BasicHttpClientConnectionManager connManager = new BasicHttpClientConnectionManager(
registryBuilder.build());
connManager.setConnectionConfig(connectionConfig);
builder.setConnectionManager(connManager);
HttpHost target = new HttpHost(host, port, scheme);
HttpContext localContext = new BasicHttpContext();
localContext.setAttribute(HttpClientContext.COOKIE_STORE, cookieStore);
CloseableHttpClient httpclient = builder.build();
CloseableHttpResponse response = httpclient.execute(target, request, localContext);
를 사용하여 시도 코드 그러나 인증 헤더를 통해 전송 자격 증명의 인코딩 된 값이 자격 증명을 지정된 캐릭터 세트 "ISO-8859-1"을 사용하여 인코딩 있지 않음을 나타냅니다 base64로입니다 다음. ConnectionConfig.setCharset()은 http 헤더 문자 집합을 설정하는 데 사용할 올바른 방법입니까? 그렇지 않은 경우 4.3.x에서 사용되지 않는 setHttpElementCharset()과 정확히 일치하는 것은 무엇입니까?
아파치 메일 보관 파일 http://mail-archives.apache.org/mod_mbox/hc-dev/201407.mbox/%[email protected]%3E은 쉽게 지원되지 않으며 BasicSchemeFactory 사용을 제안하지만 사용하는 문자셋을 지정하는 방법/위치를 파악할 수 없다는 것을 나타냅니다.