@Test public void testRewrite() throws Exception { final String host = "http: final String base = host + "/test/123/"; final String bundleWithSlash = base + "?arg=value"; final String bundle = base + "bundle.js?arg=value"; instance.renderByUrl("", bundle, null, null, 0, 0, WXRenderStrategy.APPEND_ONCE); testRelative(host, base); instance.renderByUrl("", bundleWithSlash, null, null, 0, 0, WXRenderStrategy.APPEND_ONCE); testRelative(host, base); }
@NonNull @Override public Uri rewrite(WXSDKInstance instance, String type, Uri uri) { Uri base = Uri.parse(instance.getBundleUrl()); Uri.Builder resultBuilder = uri.buildUpon(); if (uri.isRelative()) { resultBuilder = buildRelativeURI(resultBuilder, base, uri); return resultBuilder.build(); } return uri; }
DefaultUriAdapter implements URIAdapter { @NonNull @Override public Uri rewrite(WXSDKInstance instance, String type, Uri uri) { Uri base = Uri.parse(instance.getBundleUrl()); Uri.Builder resultBuilder = uri.buildUpon(); if (uri.isRelative()) { resultBuilder = buildRelativeURI(resultBuilder, base, uri); return resultBuilder.build(); } return uri; } }
DefaultUriAdapter implements URIAdapter { @NonNull @Override public Uri rewrite(WXSDKInstance instance, String type, Uri uri) { Uri base = Uri.parse(instance.getBundleUrl()); Uri.Builder resultBuilder = uri.buildUpon(); if (uri.isRelative()) { resultBuilder = buildRelativeURI(resultBuilder, base, uri); return resultBuilder.build(); } return uri; }  }
DefaultUriAdapter implements URIAdapter { @NonNull @Override public Uri rewrite(WXSDKInstance instance, String type, Uri uri) { Uri base = Uri.parse(instance.getBundleUrl()); Uri.Builder resultBuilder = uri.buildUpon(); if (uri.isRelative()) { resultBuilder = buildRelativeURI(resultBuilder, base, uri); return resultBuilder.build(); } return uri; }  @NonNull @Override Uri rewrite(WXSDKInstance instance, String type, Uri uri); }
DefaultUriAdapter implements URIAdapter { @NonNull @Override public Uri rewrite(WXSDKInstance instance, String type, Uri uri) { Uri base = Uri.parse(instance.getBundleUrl()); Uri.Builder resultBuilder = uri.buildUpon(); if (uri.isRelative()) { resultBuilder = buildRelativeURI(resultBuilder, base, uri); return resultBuilder.build(); } return uri; }  @NonNull @Override Uri rewrite(WXSDKInstance instance, String type, Uri uri);  }