use of com.firenio.codec.http11.Cookie in project java-sdk by watson-developer-cloud.
the class WatsonCookieJar method loadForRequest.
/*
* (non-Javadoc)
*
* @see okhttp3.CookieJar#loadForRequest(okhttp3.HttpUrl)
*/
@Override
public List<Cookie> loadForRequest(HttpUrl url) {
List<Cookie> cookies = this.adapter.loadForRequest(url);
// TODO: Removes the SESSIONID for speech to text session lest requests
if (url.encodedPathSegments().contains(SPEECH_TO_TEXT) && !url.encodedPathSegments().contains(SESSIONS)) {
List<Cookie> sessionLessCookies = new ArrayList<Cookie>();
for (Cookie cookie : cookies) {
if (!cookie.name().equalsIgnoreCase(SESSIONID)) {
sessionLessCookies.add(cookie);
}
}
cookies = sessionLessCookies;
}
return cookies;
}
use of com.firenio.codec.http11.Cookie in project WanAndroid by dangxy.
the class SharedPrefsCookiePersistor method loadAll.
@Override
public List<Cookie> loadAll() {
List<Cookie> cookies = new ArrayList<>(sharedPreferences.getAll().size());
for (Map.Entry<String, ?> entry : sharedPreferences.getAll().entrySet()) {
String serializedCookie = (String) entry.getValue();
Cookie cookie = new SerializableCookie().decode(serializedCookie);
if (cookie != null) {
cookies.add(cookie);
}
}
return cookies;
}
use of com.firenio.codec.http11.Cookie in project 91Pop by DanteAndroid.
the class SharedPrefsCookiePersistor method loadAll.
@Override
public List<Cookie> loadAll() {
List<Cookie> cookies = new ArrayList<>(sharedPreferences.getAll().size());
for (Map.Entry<String, ?> entry : sharedPreferences.getAll().entrySet()) {
String serializedCookie = (String) entry.getValue();
Cookie cookie = new SerializableCookie().decode(serializedCookie);
if (cookie != null) {
cookies.add(cookie);
}
}
return cookies;
}
use of com.firenio.codec.http11.Cookie in project 91Pop by DanteAndroid.
the class SharedPrefsCookiePersistor method saveAll.
@Override
public void saveAll(Collection<Cookie> cookies) {
SharedPreferences.Editor editor = sharedPreferences.edit();
for (Cookie cookie : cookies) {
editor.putString(createCookieKey(cookie), new SerializableCookie().encode(cookie));
}
editor.apply();
}
use of com.firenio.codec.http11.Cookie in project AndroidFrame by tongxiaoyun.
the class SerializableCookie method decode.
public Cookie decode(String encodedCookie) {
byte[] bytes = hexStringToByteArray(encodedCookie);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
Cookie cookie = null;
ObjectInputStream objectInputStream = null;
try {
objectInputStream = new ObjectInputStream(byteArrayInputStream);
cookie = ((SerializableCookie) objectInputStream.readObject()).cookie;
} catch (IOException e) {
Log.d(TAG, "IOException in decodeCookie", e);
} catch (ClassNotFoundException e) {
Log.d(TAG, "ClassNotFoundException in decodeCookie", e);
} finally {
if (objectInputStream != null) {
try {
objectInputStream.close();
} catch (IOException e) {
Log.d(TAG, "Stream not closed in decodeCookie", e);
}
}
}
return cookie;
}
Aggregations