Build 1.0_r1(from source)

android.webkit
Class WebViewDatabase

java.lang.Object
  extended by android.webkit.WebViewDatabase

public class WebViewDatabase
extends Object


Field Summary
protected static String LOGTAG
           
 
Method Summary
(package private)  void addCache(String url, CacheManager.CacheResult c)
          Add or update a cache.
(package private)  void addCookie(CookieManager.Cookie cookie)
          Add a cookie to the database
(package private)  void clearCache()
          Clear cache database
(package private)  void clearCookies()
          Clear cookie database
(package private)  void clearExpiredCookies(long now)
          Clear expired cookies
 void clearFormData()
          Clear form database
 void clearHttpAuthUsernamePassword()
          Clear HTTP authentication password database
(package private)  void clearSessionCookies()
          Clear session cookies, which means cookie doesn't have EXPIRES.
 void clearUsernamePassword()
          Clear password database
(package private)  void deleteCookies(String domain, String path, String name)
          Delete cookies which matches (domain, path, name).
(package private)  boolean endCacheTransaction()
           
(package private)  CacheManager.CacheResult getCache(String url)
          Get a cache item.
(package private)  long getCacheTotalSize()
           
(package private)  ArrayList<CookieManager.Cookie> getCookiesForDomain(String domain)
          Get cookies in the format of CookieManager.Cookie inside an ArrayList for a given domain
(package private)  ArrayList<String> getFormData(String url, String name)
          Get all the values for a form entry with "name" in a given site
(package private)  String[] getHttpAuthUsernamePassword(String host, String realm)
          Retrieve the HTTP authentication username and password for a given host+realm pair
static WebViewDatabase getInstance(Context context)
           
(package private)  String[] getUsernamePassword(String host)
          Retrieve the username and password for a given host
(package private)  boolean hasCache()
           
(package private)  boolean hasCookies()
          Whether there is any cookies in the database
 boolean hasFormData()
          Find out if there is form data saved.
 boolean hasHttpAuthUsernamePassword()
          Find out if there are any HTTP authentication passwords saved.
 boolean hasUsernamePassword()
          Find out if there are any passwords saved.
(package private)  void removeCache(String url)
          Remove a cache item.
(package private)  void setFormData(String url, HashMap<String,String> formdata)
          Set form data for a site.
(package private)  void setHttpAuthUsernamePassword(String host, String realm, String username, String password)
          Set HTTP authentication password.
(package private)  void setUsernamePassword(String host, String username, String password)
          Set password.
(package private)  boolean startCacheTransaction()
           
(package private)  ArrayList<String> trimCache(long amount)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGTAG

protected static final String LOGTAG
See Also:
Constant Field Values
Method Detail

getInstance

public static WebViewDatabase getInstance(Context context)

getCookiesForDomain

ArrayList<CookieManager.Cookie> getCookiesForDomain(String domain)
Get cookies in the format of CookieManager.Cookie inside an ArrayList for a given domain

Returns:
ArrayList If nothing is found, return an empty list.

deleteCookies

void deleteCookies(String domain,
                   String path,
                   String name)
Delete cookies which matches (domain, path, name).

Parameters:
domain - If it is null, nothing happens.
path - If it is null, all the cookies match (domain) will be deleted.
name - If it is null, all the cookies match (domain, path) will be deleted.

addCookie

void addCookie(CookieManager.Cookie cookie)
Add a cookie to the database

Parameters:
cookie -

hasCookies

boolean hasCookies()
Whether there is any cookies in the database

Returns:
TRUE if there is cookie.

clearCookies

void clearCookies()
Clear cookie database


clearSessionCookies

void clearSessionCookies()
Clear session cookies, which means cookie doesn't have EXPIRES.


clearExpiredCookies

void clearExpiredCookies(long now)
Clear expired cookies

Parameters:
now - Time for now

startCacheTransaction

boolean startCacheTransaction()

endCacheTransaction

boolean endCacheTransaction()

getCache

CacheManager.CacheResult getCache(String url)
Get a cache item.

Parameters:
url - The url
Returns:
CacheResult The CacheManager.CacheResult

removeCache

void removeCache(String url)
Remove a cache item.

Parameters:
url - The url

addCache

void addCache(String url,
              CacheManager.CacheResult c)
Add or update a cache. CACHE_URL_COL is unique in the table.

Parameters:
url - The url
c - The CacheManager.CacheResult

clearCache

void clearCache()
Clear cache database


hasCache

boolean hasCache()

getCacheTotalSize

long getCacheTotalSize()

trimCache

ArrayList<String> trimCache(long amount)

setUsernamePassword

void setUsernamePassword(String host,
                         String username,
                         String password)
Set password. Tuple (PASSWORD_HOST_COL, PASSWORD_USERNAME_COL) is unique.

Parameters:
host - The host for the password
username - The username for the password. If it is null, it means password can't be saved.
password - The password

getUsernamePassword

String[] getUsernamePassword(String host)
Retrieve the username and password for a given host

Parameters:
host - The host which passwords applies to
Returns:
String[] if found, String[0] is username, which can be null and String[1] is password. Return null if it can't find anything.

hasUsernamePassword

public boolean hasUsernamePassword()
Find out if there are any passwords saved.

Returns:
TRUE if there is passwords saved

clearUsernamePassword

public void clearUsernamePassword()
Clear password database


setHttpAuthUsernamePassword

void setHttpAuthUsernamePassword(String host,
                                 String realm,
                                 String username,
                                 String password)
Set HTTP authentication password. Tuple (HTTPAUTH_HOST_COL, HTTPAUTH_REALM_COL, HTTPAUTH_USERNAME_COL) is unique.

Parameters:
host - The host for the password
realm - The realm for the password
username - The username for the password. If it is null, it means password can't be saved.
password - The password

getHttpAuthUsernamePassword

String[] getHttpAuthUsernamePassword(String host,
                                     String realm)
Retrieve the HTTP authentication username and password for a given host+realm pair

Parameters:
host - The host the password applies to
realm - The realm the password applies to
Returns:
String[] if found, String[0] is username, which can be null and String[1] is password. Return null if it can't find anything.

hasHttpAuthUsernamePassword

public boolean hasHttpAuthUsernamePassword()
Find out if there are any HTTP authentication passwords saved.

Returns:
TRUE if there are passwords saved

clearHttpAuthUsernamePassword

public void clearHttpAuthUsernamePassword()
Clear HTTP authentication password database


setFormData

void setFormData(String url,
                 HashMap<String,String> formdata)
Set form data for a site. Tuple (FORMDATA_URLID_COL, FORMDATA_NAME_COL, FORMDATA_VALUE_COL) is unique

Parameters:
url - The url of the site
formdata - The form data in HashMap

getFormData

ArrayList<String> getFormData(String url,
                              String name)
Get all the values for a form entry with "name" in a given site

Parameters:
url - The url of the site
name - The name of the form entry
Returns:
A list of values. Return empty list if nothing is found.

hasFormData

public boolean hasFormData()
Find out if there is form data saved.

Returns:
TRUE if there is form data in the database

clearFormData

public void clearFormData()
Clear form database


Build 1.0_r1(from source)

Please submit a feedback, bug or feature