Android BrowserCompatSpec - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android BrowserCompatSpec class.

This code example shows how to use the following methods:
	private final SharedPreferences prefs;
 
	private boolean persistCookies;
 
	public CookieJar(Context ctx) {
		cookieSpec = new BrowserCompatSpec();
		prefs = ctx.getSharedPreferences("droidparts_restclient_cookies",
				MODE_PRIVATE);
	} 
 
	public void setPersistent(boolean persistent) {
		persistCookies = persistent;
		if (persistCookies) {
			cookies.clear();
			restoreCookies(); 
		} 
	} 
 
	// HttpURLConnection 
 
6
CodeRank
This code example shows how to use the following methods:
	private final SharedPreferences prefs;
 
	private boolean persistCookies;
 
	public CookieJar(Context ctx) {
		cookieSpec = new BrowserCompatSpec();
		prefs = ctx.getSharedPreferences("droidparts_restclient_cookies",
				MODE_PRIVATE);
	} 
 
	public void setPersistent(boolean persistent) {
		persistCookies = persistent;
		if (persistCookies) {
			cookies.clear();
			restoreCookies(); 
		} 
	} 
 
	// HttpURLConnection 
 
6
CodeRank
This code example shows how to use the following methods:formatCookies
	/** 
	 * @param request 
	 */ 
	public static void addCookies(MobileRequest request) {
		if ((cookies != null) && (!cookies.isEmpty())) {
			CookieSpecBase cookieSpecBase = new BrowserCompatSpec();
			List<Cookie> cookies = new ArrayList<Cookie>();
			cookies.addAll(getCookies());
			List<Header> cookieHeader = cookieSpecBase.formatCookies(cookies);
			request.getPostRequest().setHeader((Header) cookieHeader.get(0));
		} 
	} 
 
	public static void clearCookies() { 
		if (cookies != null)
			cookies.clear();
	} 
 
	/** 
	 * @param cookiesString 
4
CodeRank
This code example shows how to use the following methods:formatCookies
			} 
	} 
 
	public static void addCookies(FWRequest request) {
		if ((cookies != null) && (!cookies.isEmpty())) {
			CookieSpecBase cookieSpecBase = new BrowserCompatSpec();
			List<Cookie> cookies = new ArrayList<Cookie>();
			cookies.addAll(getCookies());
			List<Header> cookieHeader = cookieSpecBase.formatCookies(cookies);
			request.getPostRequest().setHeader((Header) cookieHeader.get(0));
		} 
	} 
 
	public static void clearCookies() { 
		instanceAuthId = null;
		if (cookies != null)
			cookies.clear();
	} 
} 
4
CodeRank
This code example shows how to use the following methods:
 
public class PortalAPI  
{ 
	String SessionID = "";
	Cookie sessionCookie;
	CookieSpecBase cookieSpecBase = new BrowserCompatSpec();
	 
	public String Login(List<NameValuePair> Credentials) 
	{   
		// Create a new HttpClient and Post Header   
		HttpClient httpclient = new DefaultHttpClient();  
		HttpPost httppost = new HttpPost("https://portal.pulsant.com/api.php?format=json&action=login");  
		HttpResponse response = null;
		JSONObject json;
		String Success;
		 
		try  
		{   
			httppost.setEntity(new UrlEncodedFormEntity(Credentials));  
			response = httpclient.execute(httppost);  
3
CodeRank
This code example shows how to use the following methods:parse
     */ 
    @Test 
    @Browsers(Browser.NONE) 
    public void httpClientParsesCookiesQuotedValuesCorrectly() throws Exception { 
        final Header header = new BasicHeader("Set-Cookie", "first=\"hello world\"");
        final BrowserCompatSpec spec = new BrowserCompatSpec();
        final CookieOrigin origin = new CookieOrigin("localhost", 80, "/", false);
        final List<org.apache.http.cookie.Cookie> list = spec.parse(header, origin);
        assertEquals(1, list.size());
        assertEquals("\"hello world\"", list.get(0).getValue());
    } 
 
    /** 
     * @throws Exception if the test fails 
     */ 
    @Test 
    @Alerts("nbCalls=1") 
    public void serverModifiesCookieValue() throws Exception { 
        final List<NameValuePair> responseHeader = new ArrayList<NameValuePair>();
        responseHeader.add(new NameValuePair("Set-Cookie", "nbCalls=1"));
4
CodeRank
This code example shows how to use the following methods:
 
public class PortalAPI  
{ 
	String SessionID = "";
	Cookie sessionCookie;
	CookieSpecBase cookieSpecBase = new BrowserCompatSpec();
	 
	public String Login(List<NameValuePair> Credentials) 
	{   
		// Create a new HttpClient and Post Header   
		HttpClient httpclient = new DefaultHttpClient();  
		HttpPost httppost = new HttpPost("https://portal.dedipower.com/api.php?format=json&action=login");  
		HttpResponse response = null;
		JSONObject json;
		String Success;
		 
		try  
		{   
			httppost.setEntity(new UrlEncodedFormEntity(Credentials));  
			response = httpclient.execute(httppost);  
3
CodeRank
This code example shows how to use the following methods:
	private DefaultHttpClient mClient = null;
	 
	// The PostProcessor is used to rewrite POST forms as GET 
	private PostProcessor mPostProcessor = new PostProcessor();
	private CacheManager mCacheManager = CacheManager.getCacheManager();
	private BrowserCompatSpec mCookieSpec = new BrowserCompatSpec();
	private CookieManager mCookieManager = CookieManager.getInstance(); 
	 
	// Settings 
	private boolean mSendReferrer = true;
	 
	private ArrayList<HttpRequestBase> mLatestRequests = new ArrayList<HttpRequestBase>();
	 
	/** 
	 * Set the port for the HTTP proxy 
	 * @param port 
	 */ 
	public void setPort(int port) {
		 
		if (this.mPort != port) {
3
CodeRank

Related Android BrowserCompatSpec Questions & Answers:

See Code Examples for Android BrowserCompatSpec Methods: