Search in sources :

Example 36 with CookieStore

use of java.net.CookieStore in project robovm by robovm.

the class CookiesTest method testCookieStoreUriDropsPath.

public void testCookieStoreUriDropsPath() throws URISyntaxException {
    CookieStore cookieStore = new CookieManager().getCookieStore();
    cookieStore.add(new URI("http://a.com/a/"), new HttpCookie("a", "android"));
    assertEquals(Arrays.asList(new URI("http://a.com")), cookieStore.getURIs());
}
Also used : CookieStore(java.net.CookieStore) URI(java.net.URI) HttpCookie(java.net.HttpCookie) CookieManager(java.net.CookieManager)

Example 37 with CookieStore

use of java.net.CookieStore in project LuaViewSDK by alibaba.

the class CookieManager method getNetRequestCookies.

/**
     * net cookies
     */
private static String getNetRequestCookies() {
    final CookieStore cookieStore = getCookieManager().getCookieStore();
    //net cookie
    if (cookieStore != null) {
        final List<HttpCookie> cookies = cookieStore.getCookies();
        if (cookies != null && cookies.size() > 0) {
            //While joining the Cookies, use ',' or ';' as needed. Most of the server are using ';'
            final String netCookie = TextUtils.join(";", cookies);
            LogUtil.d(TAG, "get-net", netCookie);
            return netCookie;
        }
    }
    return null;
}
Also used : CookieStore(java.net.CookieStore) HttpCookie(java.net.HttpCookie)

Aggregations

CookieStore (java.net.CookieStore)37 HttpCookie (java.net.HttpCookie)33 CookieManager (java.net.CookieManager)28 URI (java.net.URI)26 RefTag (com.kickstarter.libs.RefTag)2 Project (com.kickstarter.models.Project)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Nullable (android.support.annotation.Nullable)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 Serializable (java.io.Serializable)1 URISyntaxException (java.net.URISyntaxException)1 Map (java.util.Map)1 NewCookie (javax.ws.rs.core.NewCookie)1 Message (org.apache.camel.Message)1 RuntimeCamelException (org.apache.camel.RuntimeCamelException)1 HeaderFilterStrategy (org.apache.camel.spi.HeaderFilterStrategy)1 ContentProvider (org.eclipse.jetty.client.api.ContentProvider)1 HttpFields (org.eclipse.jetty.http.HttpFields)1