List of usage examples for android.util Config LOGV
boolean LOGV
To view the source code for android.util Config LOGV.
Click Source Link
From source file:android.webkit.LoadListener.java
/** * SSL certificate error callback. Handles SSL error(s) on the way up * to the user.//from www . jav a2 s. c o m * IMPORTANT: as this is called from network thread, can't call native * directly */ public void handleSslErrorRequest(SslError error) { if (Config.LOGV) { Log.v(LOGTAG, "LoadListener.handleSslErrorRequest(): url:" + url() + " primary error: " + error.getPrimaryError() + " certificate: " + error.getCertificate()); } if (!mCancelled) { mSslError = error; Network.getInstance(mContext).handleSslErrorRequest(this); } }
From source file:android.webkit.LoadListener.java
/** * Uses user-supplied credentials to restar a request. *//*from w w w .ja v a 2 s . c o m*/ void handleAuthResponse(String username, String password) { if (Config.LOGV) { Log.v(LOGTAG, "LoadListener.handleAuthResponse: url: " + mUrl + " username: " + username + " password: " + password); } // create and queue an authentication-response if (username != null && password != null) { if (mAuthHeader != null && mRequestHandle != null) { mAuthHeader.setUsername(username); mAuthHeader.setPassword(password); int scheme = mAuthHeader.getScheme(); if (scheme == HttpAuthHeader.BASIC) { // create a basic response boolean isProxy = mAuthHeader.isProxy(); mRequestHandle.setupBasicAuthResponse(isProxy, username, password); } else { if (scheme == HttpAuthHeader.DIGEST) { // create a digest response boolean isProxy = mAuthHeader.isProxy(); String realm = mAuthHeader.getRealm(); String nonce = mAuthHeader.getNonce(); String qop = mAuthHeader.getQop(); String algorithm = mAuthHeader.getAlgorithm(); String opaque = mAuthHeader.getOpaque(); mRequestHandle.setupDigestAuthResponse(isProxy, username, password, realm, nonce, qop, algorithm, opaque); } } } } }
From source file:android.webkit.LoadListener.java
void attachRequestHandle(RequestHandle requestHandle) { if (Config.LOGV) { Log.v(LOGTAG, "LoadListener.attachRequestHandle(): " + "requestHandle: " + requestHandle); }//from w w w .j a va 2 s. com mRequestHandle = requestHandle; }
From source file:android.webkit.LoadListener.java
void detachRequestHandle() { if (Config.LOGV) { Log.v(LOGTAG, "LoadListener.detachRequestHandle(): " + "requestHandle: " + mRequestHandle); }//from ww w .j a v a 2 s . co m mRequestHandle = null; }
From source file:android.webkit.LoadListener.java
static boolean willLoadFromCache(String url) { boolean inCache = CacheManager.getCacheFile(url, null) != null; if (Config.LOGV) { Log.v(LOGTAG, "willLoadFromCache: " + url + " in cache: " + inCache); }/*from w w w . j a v a2 s.c o m*/ return inCache; }
From source file:android.webkit.LoadListener.java
/** * Cancel a request./*from w ww . j a v a2 s.c o m*/ * FIXME: This will only work if the request has yet to be handled. This * is in no way guarenteed if requests are served in a separate thread. * It also causes major problems if cancel is called during an * EventHandler's method call. */ public void cancel() { if (Config.LOGV) { if (mRequestHandle == null) { Log.v(LOGTAG, "LoadListener.cancel(): no requestHandle"); } else { Log.v(LOGTAG, "LoadListener.cancel()"); } } if (mRequestHandle != null) { mRequestHandle.cancel(); mRequestHandle = null; } mCacheResult = null; mCancelled = true; clearNativeLoader(); }
From source file:android.webkit.LoadListener.java
private void doRedirect() { // as cancel() can cancel the load before doRedirect() is // called through handleMessage, needs to check to see if we // are canceled before proceed if (mCancelled) { return;//from w ww. j ava 2 s. c o m } String redirectTo = mHeaders.getLocation(); if (redirectTo != null) { int nativeResponse = createNativeResponse(); redirectTo = nativeRedirectedToUrl(mUrl, redirectTo, nativeResponse); // nativeRedirectedToUrl() may call cancel(), e.g. when redirect // from a https site to a http site, check mCancelled again if (mCancelled) { return; } if (redirectTo == null) { Log.d(LOGTAG, "Redirection failed for " + mHeaders.getLocation()); cancel(); return; } else if (!URLUtil.isNetworkUrl(redirectTo)) { final String text = mContext.getString(com.android.internal.R.string.open_permission_deny) + "\n" + redirectTo; nativeAddData(text.getBytes(), text.length()); nativeFinished(); clearNativeLoader(); return; } if (mOriginalUrl == null) { mOriginalUrl = mUrl; } // Cache the redirect response if (mCacheResult != null) { if (getErrorID() == OK) { CacheManager.saveCacheFile(mUrl, mCacheResult); } mCacheResult = null; } setUrl(redirectTo); // Redirect may be in the cache if (mRequestHeaders == null) { mRequestHeaders = new HashMap<String, String>(); } if (!checkCache(mRequestHeaders)) { // mRequestHandle can be null when the request was satisfied // by the cache, and the cache returned a redirect if (mRequestHandle != null) { mRequestHandle.setupRedirect(redirectTo, mStatusCode, mRequestHeaders); } else { String method = mMethod; if (method == null) { return; } Network network = Network.getInstance(getContext()); network.requestURL(method, mRequestHeaders, mPostData, this, mIsHighPriority); } } } else { cancel(); } if (Config.LOGV) { Log.v(LOGTAG, "LoadListener.onRedirect(): redirect to: " + redirectTo); } }
From source file:android.webkit.LoadListener.java
private void parseContentTypeHeader(String contentType) { if (Config.LOGV) { Log.v(LOGTAG, "LoadListener.parseContentTypeHeader: " + "contentType: " + contentType); }/*w w w.jav a2 s.c o m*/ if (contentType != null) { int i = contentType.indexOf(';'); if (i >= 0) { mMimeType = contentType.substring(0, i); int j = contentType.indexOf('=', i); if (j > 0) { i = contentType.indexOf(';', j); if (i < j) { i = contentType.length(); } mEncoding = contentType.substring(j + 1, i); } else { mEncoding = contentType.substring(i + 1); } // Trim excess whitespace. mEncoding = mEncoding.trim(); if (i < contentType.length() - 1) { // for data: uri the mimeType and encoding have // the form image/jpeg;base64 or text/plain;charset=utf-8 // or text/html;charset=utf-8;base64 mTransferEncoding = contentType.substring(i + 1).trim(); } } else { mMimeType = contentType; } // Trim leading and trailing whitespace mMimeType = mMimeType.trim(); try { Matcher m = CONTENT_TYPE_PATTERN.matcher(mMimeType); if (m.find()) { mMimeType = m.group(1); } else { guessMimeType(); } } catch (IllegalStateException ex) { guessMimeType(); } } }
From source file:android.webkit.LoadListener.java
/** * guess MIME type based on the file extension. *//*w w w . j av a 2 s .c om*/ private String guessMimeTypeFromExtension() { // PENDING: need to normalize url if (Config.LOGV) { Log.v(LOGTAG, "guessMimeTypeFromExtension: mURL = " + mUrl); } String mimeType = MimeTypeMap.getSingleton() .getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(mUrl)); if (mimeType != null) { // XXX: Until the servers send us either correct xhtml or // text/html, treat application/xhtml+xml as text/html. if (mimeType.equals("application/xhtml+xml")) { mimeType = "text/html"; } } return mimeType; }