FileDocCategorySizeDatePackage
UrlInterceptRegistry.javaAPI DocAndroid 1.5 API4275Wed May 06 22:41:56 BST 2009android.webkit

UrlInterceptRegistry

public final class UrlInterceptRegistry extends Object

Fields Summary
private static final String
LOGTAG
private static boolean
mDisabled
private static LinkedList
mHandlerList
Constructors Summary
Methods Summary
private static synchronized java.util.LinkedListgetHandlers()


         
        if(mHandlerList == null)
            mHandlerList = new LinkedList<UrlInterceptHandler>();
        return mHandlerList;
    
public static synchronized android.webkit.PluginDatagetPluginData(java.lang.String url, java.util.Map headers)
Given an url, returns the PluginData of the first UrlInterceptHandler interested, or null if none are or if intercepts are disabled.

return
A PluginData instance containing surrogate content.

        if (urlInterceptDisabled()) {
            return null;
        }
        Iterator iter = getHandlers().listIterator();
        while (iter.hasNext()) {
            UrlInterceptHandler handler = (UrlInterceptHandler) iter.next();
            PluginData data = handler.getPluginData(url, headers);
            if (data != null) {
                return data;
            }
        }
        return null;
    
public static synchronized android.webkit.CacheManager.CacheResultgetSurrogate(java.lang.String url, java.util.Map headers)
Given an url, returns the CacheResult of the first UrlInterceptHandler interested, or null if none are.

return
A CacheResult containing surrogate content.
Deprecated
Use PluginData getPluginData( String url, Map headers) instead.

        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;
    
public static synchronized booleanregisterHandler(android.webkit.UrlInterceptHandler handler)
Register a new UrlInterceptHandler. This handler will be called before any that were previously registered.

param
handler The new UrlInterceptHandler object
return
true if the handler was not previously registered.

        if (!getHandlers().contains(handler)) {
            getHandlers().addFirst(handler);
            return true;
        } else {
            return false;
        }
    
public static synchronized voidsetUrlInterceptDisabled(boolean disabled)
set the flag to control whether url intercept is enabled or disabled

param
disabled true to disable the cache

        mDisabled = disabled;
    
public static synchronized booleanunregisterHandler(android.webkit.UrlInterceptHandler handler)
Unregister a previously registered UrlInterceptHandler.

param
handler A previously registered UrlInterceptHandler.
return
true if the handler was found and removed from the list.

        return getHandlers().remove(handler);
    
public static synchronized booleanurlInterceptDisabled()
get the state of the url intercept, enabled or disabled

return
return if it is disabled

        return mDisabled;