Search in sources :

Example 6 with CacheResult

use of android.webkit.CacheManager.CacheResult in project XobotOS by xamarin.

the class WebViewDatabase method getCache.

/**
     * Get a cache item.
     * 
     * @param url The url
     * @return CacheResult The CacheManager.CacheResult
     */
CacheResult getCache(String url) {
    assert !JniUtil.useChromiumHttpStack();
    if (url == null || !checkInitialized()) {
        return null;
    }
    Cursor cursor = null;
    final String query = "SELECT filepath, lastmodify, etag, expires, " + "expiresstring, mimetype, encoding, httpstatus, location, contentlength, " + "contentdisposition, crossdomain FROM cache WHERE url = ?";
    try {
        cursor = mCacheDatabase.rawQuery(query, new String[] { url });
        if (cursor.moveToFirst()) {
            CacheResult ret = new CacheResult();
            ret.localPath = cursor.getString(0);
            ret.lastModified = cursor.getString(1);
            ret.etag = cursor.getString(2);
            ret.expires = cursor.getLong(3);
            ret.expiresString = cursor.getString(4);
            ret.mimeType = cursor.getString(5);
            ret.encoding = cursor.getString(6);
            ret.httpStatusCode = cursor.getInt(7);
            ret.location = cursor.getString(8);
            ret.contentLength = cursor.getLong(9);
            ret.contentdisposition = cursor.getString(10);
            ret.crossDomain = cursor.getString(11);
            return ret;
        }
    } catch (IllegalStateException e) {
        Log.e(LOGTAG, "getCache", e);
    } finally {
        if (cursor != null)
            cursor.close();
    }
    return null;
}
Also used : CacheResult(android.webkit.CacheManager.CacheResult) Cursor(android.database.Cursor)

Example 7 with CacheResult

use of android.webkit.CacheManager.CacheResult in project android_frameworks_base by crdroidandroid.

the class UrlInterceptRegistry method getSurrogate.

/**
     * Given an url, returns the CacheResult of the first
     * UrlInterceptHandler interested, or null if none are.
     *
     * @return A CacheResult containing surrogate content.
     *
     * @hide
     * @deprecated This class was intended to be used by Gears. Since Gears was
     * deprecated, so is this class.
     */
@Deprecated
public static synchronized CacheResult getSurrogate(String url, Map<String, String> headers) {
    if (urlInterceptDisabled()) {
        return null;
    }
    Iterator iter = getHandlers().listIterator();
    while (iter.hasNext()) {
        UrlInterceptHandler handler = (UrlInterceptHandler) iter.next();
        CacheResult result = handler.service(url, headers);
        if (result != null) {
            return result;
        }
    }
    return null;
}
Also used : UrlInterceptHandler(android.webkit.UrlInterceptHandler) Iterator(java.util.Iterator) CacheResult(android.webkit.CacheManager.CacheResult)

Example 8 with CacheResult

use of android.webkit.CacheManager.CacheResult in project platform_frameworks_base by android.

the class UrlInterceptRegistry method getSurrogate.

/**
     * Given an url, returns the CacheResult of the first
     * UrlInterceptHandler interested, or null if none are.
     *
     * @return A CacheResult containing surrogate content.
     *
     * @hide
     * @deprecated This class was intended to be used by Gears. Since Gears was
     * deprecated, so is this class.
     */
@Deprecated
public static synchronized CacheResult getSurrogate(String url, Map<String, String> headers) {
    if (urlInterceptDisabled()) {
        return null;
    }
    Iterator iter = getHandlers().listIterator();
    while (iter.hasNext()) {
        UrlInterceptHandler handler = (UrlInterceptHandler) iter.next();
        CacheResult result = handler.service(url, headers);
        if (result != null) {
            return result;
        }
    }
    return null;
}
Also used : UrlInterceptHandler(android.webkit.UrlInterceptHandler) Iterator(java.util.Iterator) CacheResult(android.webkit.CacheManager.CacheResult)

Example 9 with CacheResult

use of android.webkit.CacheManager.CacheResult in project XobotOS by xamarin.

the class UrlInterceptRegistry method getSurrogate.

/**
     * Given an url, returns the CacheResult of the first
     * UrlInterceptHandler interested, or null if none are.
     *
     * @return A CacheResult containing surrogate content.
     *
     * @hide
     * @deprecated This class was intended to be used by Gears. Since Gears was
     * deprecated, so is this class.
     */
@Deprecated
public static synchronized CacheResult getSurrogate(String url, Map<String, String> headers) {
    if (urlInterceptDisabled()) {
        return null;
    }
    Iterator iter = getHandlers().listIterator();
    while (iter.hasNext()) {
        UrlInterceptHandler handler = (UrlInterceptHandler) iter.next();
        CacheResult result = handler.service(url, headers);
        if (result != null) {
            return result;
        }
    }
    return null;
}
Also used : UrlInterceptHandler(android.webkit.UrlInterceptHandler) Iterator(java.util.Iterator) CacheResult(android.webkit.CacheManager.CacheResult)

Example 10 with CacheResult

use of android.webkit.CacheManager.CacheResult in project android_frameworks_base by DirtyUnicorns.

the class UrlInterceptRegistry method getSurrogate.

/**
     * Given an url, returns the CacheResult of the first
     * UrlInterceptHandler interested, or null if none are.
     *
     * @return A CacheResult containing surrogate content.
     *
     * @hide
     * @deprecated This class was intended to be used by Gears. Since Gears was
     * deprecated, so is this class.
     */
@Deprecated
public static synchronized CacheResult getSurrogate(String url, Map<String, String> headers) {
    if (urlInterceptDisabled()) {
        return null;
    }
    Iterator iter = getHandlers().listIterator();
    while (iter.hasNext()) {
        UrlInterceptHandler handler = (UrlInterceptHandler) iter.next();
        CacheResult result = handler.service(url, headers);
        if (result != null) {
            return result;
        }
    }
    return null;
}
Also used : UrlInterceptHandler(android.webkit.UrlInterceptHandler) Iterator(java.util.Iterator) CacheResult(android.webkit.CacheManager.CacheResult)

Aggregations

CacheResult (android.webkit.CacheManager.CacheResult)10 UrlInterceptHandler (android.webkit.UrlInterceptHandler)7 Iterator (java.util.Iterator)7 Cursor (android.database.Cursor)1 Headers (android.net.http.Headers)1 Method (java.lang.reflect.Method)1 CharArrayBuffer (org.apache.http.util.CharArrayBuffer)1