Android BestMatchSpec - 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 BestMatchSpec class.

This code example shows how to use the following methods:parse
     * Takes the value of the <code>Set-Cookie</code> HTTP header from login and 
     * creates a cookie from it. 
    private static Cookie genCookie(String setCookieValue) {
        Header setCookieHeader = new BasicHeader("Set-Cookie", setCookieValue);
        CookieSpec cookieSpec = new BestMatchSpec();
        Uri uri = Uri.parse(getBaseUri());
        CookieOrigin origin = new CookieOrigin(uri.getHost(), uri.getPort(), "/", false);
        try { 
            List<Cookie> cookies = cookieSpec.parse(setCookieHeader, origin);
            if (cookies != null && cookies.size() > 0) {
                return cookies.get(0);
            else { 
                Log.e(TAG, "Authtoken Set-Cookie value did not parse to anything");
        catch (MalformedCookieException e) {
This code example shows how to use the following methods:
    private CookieStore cookieStore;
    public void setUp() throws Exception { 
        this.cookieOrigin = new CookieOrigin("localhost", 80, "/", false);
        this.cookieSpec = new BestMatchSpec();
        this.cookieStore = new BasicCookieStore();
    public void testResponseParameterCheck() throws Exception { 
        HttpContext context = new BasicHttpContext();
        HttpResponseInterceptor interceptor = new ResponseProcessCookies();
        interceptor.process(null, context);
    public void testContextParameterCheck() throws Exception { 
        HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
        HttpResponseInterceptor interceptor = new ResponseProcessCookies();
See Code Examples for Android BestMatchSpec Methods: