本文整理了Java中okhttp3.Cookie.toString()
方法的一些代码示例,展示了Cookie.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cookie.toString()
方法的具体详情如下:
包路径:okhttp3.Cookie
类名称:Cookie
方法名:toString
暂无
代码示例来源:origin: square/okhttp
@Override public String toString() {
return toString(false);
}
代码示例来源:origin: com.squareup.okhttp3/okhttp
@Override public String toString() {
return toString(false);
}
代码示例来源:origin: square/okhttp
public void assertResponseCookies(String... cookies) {
List<Cookie> actualCookies = takeResponseCookies();
List<String> actualCookieStrings = new ArrayList<>();
for (Cookie cookie : actualCookies) {
actualCookieStrings.add(cookie.toString());
}
assertEquals(Arrays.asList(cookies), actualCookieStrings);
}
代码示例来源:origin: square/okhttp
@Override public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
if (cookieHandler != null) {
List<String> cookieStrings = new ArrayList<>();
for (Cookie cookie : cookies) {
cookieStrings.add(cookie.toString(true));
}
Map<String, List<String>> multimap = Collections.singletonMap("Set-Cookie", cookieStrings);
try {
cookieHandler.put(url.uri(), multimap);
} catch (IOException e) {
Platform.get().log(WARN, "Saving cookies failed for " + url.resolve("/..."), e);
}
}
}
代码示例来源:origin: seven332/EhViewer
EhCookieStore store = EhApplication.getEhCookieStore(this);
for (Cookie cookie : store.getCookies(HttpUrl.parse(url))) {
cookieManager.setCookie(url, cookie.toString());
代码示例来源:origin: org.leapframework/leap-webunit
@Override
public String toString() {
return cookie.toString();
}
}
代码示例来源:origin: marklogic/java-client-api
public String toString() {
return cookie.toString();
}
}
代码示例来源:origin: com.github.ljun20160606/okhttp
@Override public String toString() {
return toString(false);
}
代码示例来源:origin: apache/servicemix-bundles
@Override public String toString() {
return toString(false);
}
代码示例来源:origin: SunAlwaysOnline/Sukeda
public static void show() {
for (int i = 0; i < cookies.size(); i++) {
Log.e("tag", cookies.get(i).toString());
}
}
代码示例来源:origin: owncloud/android-library
public String getCookiesString() {
String cookiesString = "";
List<Cookie> cookieList = getCookiesFromUrl(HttpUrl.parse(mBaseUri.toString()));
if (cookieList != null) {
for (Cookie cookie : cookieList) {
cookiesString += cookie.toString() + ";";
}
}
return cookiesString;
}
代码示例来源:origin: FussenYu/MVP_Project
private static List<Cookie> filterPersistentCookies(List<Cookie> cookies) {
List<Cookie> persistentCookies = new ArrayList<>();
for (Cookie cookie : cookies) {
Log.i(TAG,"=====cookie===="+ cookie.toString());
if (cookie.persistent()) {
persistentCookies.add(cookie);
}
}
return persistentCookies;
}
代码示例来源:origin: com.squareup.okhttp3/okhttp-testing-support
public void assertResponseCookies(String... cookies) {
List<Cookie> actualCookies = takeResponseCookies();
List<String> actualCookieStrings = new ArrayList<>();
for (Cookie cookie : actualCookies) {
actualCookieStrings.add(cookie.toString());
}
assertEquals(Arrays.asList(cookies), actualCookieStrings);
}
代码示例来源:origin: com.github.ljun20160606/okhttp-testing-support
public void assertResponseCookies(String... cookies) {
List<Cookie> actualCookies = takeResponseCookies();
List<String> actualCookieStrings = new ArrayList<>();
for (Cookie cookie : actualCookies) {
actualCookieStrings.add(cookie.toString());
}
assertEquals(Arrays.asList(cookies), actualCookieStrings);
}
代码示例来源:origin: zJiaJun/adult-download
@Override
public void store(HttpUrl httpUrl, List<Cookie> list) {
if (Config.getInstance().loginUrl().equals(httpUrl.toString())) {
cookieCache.put(httpUrl.host(), list);
list.forEach(cookie -> FileUtils.append(cookie.toString() + '\n', COOKIE_FILE));
}
}
代码示例来源:origin: com.squareup.okhttp3/okhttp-urlconnection
@Override public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
if (cookieHandler != null) {
List<String> cookieStrings = new ArrayList<>();
for (Cookie cookie : cookies) {
cookieStrings.add(cookie.toString(true));
}
Map<String, List<String>> multimap = Collections.singletonMap("Set-Cookie", cookieStrings);
try {
cookieHandler.put(url.uri(), multimap);
} catch (IOException e) {
Platform.get().log(WARN, "Saving cookies failed for " + url.resolve("/..."), e);
}
}
}
代码示例来源:origin: com.github.ljun20160606/okhttp-urlconnection
@Override public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
if (cookieHandler != null) {
List<String> cookieStrings = new ArrayList<>();
for (Cookie cookie : cookies) {
cookieStrings.add(cookie.toString(true));
}
Map<String, List<String>> multimap = Collections.singletonMap("Set-Cookie", cookieStrings);
try {
cookieHandler.put(url.uri(), multimap);
} catch (IOException e) {
Platform.get().log(WARN, "Saving cookies failed for " + url.resolve("/..."), e);
}
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
if (cookieHandler != null) {
List<String> cookieStrings = new ArrayList<>();
for (Cookie cookie : cookies) {
cookieStrings.add(cookie.toString(true));
}
Map<String, List<String>> multimap = Collections.singletonMap("Set-Cookie", cookieStrings);
try {
cookieHandler.put(url.uri(), multimap);
} catch (IOException e) {
Platform.get().log(WARN, "Saving cookies failed for " + url.resolve("/..."), e);
}
}
}
代码示例来源:origin: schildbach/public-transport-enabler
final Cookie sessionCookie = this.sessionCookie;
if (sessionCookie != null && sessionCookie.name().equals(sessionCookieName))
request.header("Cookie", sessionCookie.toString());
代码示例来源:origin: cloudant/java-cloudant
private static String setCookie(String name, String value, Long cookieLifetime) {
Cookie.Builder cookieBuilder = new Cookie.Builder()
// Explicitly declare the localhost domain to workaround
// https://bugs.openjdk.java.net/browse/JDK-7169142
.domain("localhost.local")
.httpOnly()
.path("/")
.name(name)
.value(value);
// Couch uses Expires not Max-age on its cookies, so that's what we use to test
if (cookieLifetime != null && cookieLifetime > 0) {
cookieBuilder.expiresAt(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(cookieLifetime));
}
String setCookie = cookieBuilder.build().toString();
System.err.println("Cookie" + setCookie);
return setCookie;
}
内容来源于网络,如有侵权,请联系作者删除!