public InputConnection handleResourceRequest(BrowserFieldRequest request) throws Exception { String url = request.getURL(); if (RhodesApp.getInstance().isRhodesAppUrl(url) || URI.isLocalData(url)) { HttpConnection connection = Utilities.makeConnection(url, request.getHeaders(), null, null); return connection; } else return super.handleResourceRequest(request); }
public HttpConnection getResource(RequestedResource resource, BrowserContent referrer) { if (resource == null) return null; String url = resource.getUrl(); if (url == null || url.endsWith("/favicon.ico")) return null; try { if (referrer == null || URI.isLocalData(url) || !m_bLoadImageAsync) { boolean bLocalHost = RhodesApp.getInstance().isRhodesAppUrl(url); if (bLocalHost && m_connResource != null) { com.rho.net.RhoConnection rhoConn = (com.rho.net.RhoConnection) ((com.rho.net.bb.NativeBBHttpConnection) m_connResource).getNativeConnection(); rhoConn.resetUrl(url); Utilities.makeConnection(url, resource.getRequestHeaders(), null, m_connResource); return m_connResource; } else { HttpConnection connection = Utilities.makeConnection(url, resource.getRequestHeaders(), null, null); // if (bLocalHost) // m_connResource = connection; return connection; } } else { SecondaryResourceFetchThread.enqueue(resource, referrer); } } catch (Exception exc) { LOG.ERROR("getResource failed.", exc); } return null; /* // check if this is cache-only request if (resource.isCacheOnly()) { // no cache support return null; } String url = resource.getUrl(); if (url == null) { return null; } try{ // if referrer is null we must return the connection if (referrer == null) { HttpConnection connection = Utilities.makeConnection(url, resource.getRequestHeaders(), null); return connection; } else { if ( URI.isLocalHost(url) || URI.isLocalData(url)) { HttpConnection connection = Utilities.makeConnection(url, resource.getRequestHeaders(), null); return connection; }else { // if referrer is provided we can set up the connection on a separate thread SecondaryResourceFetchThread.enqueue(resource, referrer); } } }catch(Exception exc) { LOG.ERROR("getResource failed.", exc); } return null;*/ }