com.taobao.weex.http.WXHttpUtil Java Examples
The following examples show how to use
com.taobao.weex.http.WXHttpUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WXSDKInstance.java From ucar-weex-core with Apache License 2.0 | 5 votes |
private void renderByUrlInternal(String pageName, final String url, Map<String, Object> options, final String jsonInitData, final WXRenderStrategy flag) { ensureRenderArchor(); pageName = wrapPageName(pageName, url); mBundleUrl = url; if(WXSDKManager.getInstance().getValidateProcessor()!=null) { mNeedValidate = WXSDKManager.getInstance().getValidateProcessor().needValidate(mBundleUrl); } Map<String, Object> renderOptions = options; if (renderOptions == null) { renderOptions = new HashMap<>(); } if (!renderOptions.containsKey(BUNDLE_URL)) { renderOptions.put(BUNDLE_URL, url); } Uri uri = Uri.parse(url); if (uri != null && TextUtils.equals(uri.getScheme(), "file")) { render(pageName, WXFileUtils.loadFileOrAsset(assembleFilePath(uri), mContext), renderOptions, jsonInitData, flag); return; } IWXHttpAdapter adapter = WXSDKManager.getInstance().getIWXHttpAdapter(); WXRequest wxRequest = new WXRequest(); wxRequest.url = rewriteUri(Uri.parse(url),URIAdapter.BUNDLE).toString(); if (wxRequest.paramMap == null) { wxRequest.paramMap = new HashMap<String, String>(); } wxRequest.paramMap.put(KEY_USER_AGENT, WXHttpUtil.assembleUserAgent(mContext,WXEnvironment.getConfig())); WXHttpListener httpListener = new WXHttpListener(pageName, renderOptions, jsonInitData, flag, System.currentTimeMillis()); httpListener.setSDKInstance(this); adapter.sendRequest(wxRequest, (IWXHttpAdapter.OnHttpListener) httpListener); }
Example #2
Source File: WXSDKInstance.java From weex-uikit with MIT License | 5 votes |
private void renderByUrlInternal(String pageName, final String url, Map<String, Object> options, final String jsonInitData, final WXRenderStrategy flag) { ensureRenderArchor(); pageName = wrapPageName(pageName, url); mBundleUrl = url; Map<String, Object> renderOptions = options; if (renderOptions == null) { renderOptions = new HashMap<>(); } if (!renderOptions.containsKey(BUNDLE_URL)) { renderOptions.put(BUNDLE_URL, url); } Uri uri = Uri.parse(url); if (uri != null && TextUtils.equals(uri.getScheme(), "file")) { render(pageName, WXFileUtils.loadAsset(assembleFilePath(uri), mContext), renderOptions, jsonInitData, flag); return; } IWXHttpAdapter adapter = WXSDKManager.getInstance().getIWXHttpAdapter(); WXRequest wxRequest = new WXRequest(); wxRequest.url = rewriteUri(Uri.parse(url),URIAdapter.BUNDLE).toString(); if (wxRequest.paramMap == null) { wxRequest.paramMap = new HashMap<String, String>(); } wxRequest.paramMap.put(KEY_USER_AGENT, WXHttpUtil.assembleUserAgent(mContext,WXEnvironment.getConfig())); adapter.sendRequest(wxRequest, new WXHttpListener(pageName, renderOptions, jsonInitData, flag, System.currentTimeMillis())); }