, @heafach. ( org.apache.http.wire, ) :
<< "Set-Cookie: fake=fake_value[\r][\n]"
HttpClient
GET, "" .
, .
, ( DIGEST)
( HTTP tutorial), "200 OK".
CookieStore cookieStore = new BasicCookieStore();
BasicClientCookie cookie = new BasicClientCookie("fake", "fake_value");
cookie.setDomain("httpbin.org");
cookie.setPath("/");
cookieStore.addCookie(cookie);
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCookieStore(cookieStore)
.setDefaultCredentialsProvider(credsProvider)
.build();
gist, "nonce"
digestAuth.overrideParamter("nonce", calculateNonce());
org.apache.http.impl.auth.HttpAuthenticator " nonce ".
public static synchronized String calculateNonce() {
Date d = new Date();
SimpleDateFormat f = new SimpleDateFormat("yyyy:MM:dd:hh:mm:ss");
String fmtDate = f.format(d);
Random rand = new Random(100000);
Integer randomInt = rand.nextInt();
return org.apache.commons.codec.digest.DigestUtils.md5Hex(fmtDate + randomInt.toString());
}