You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Andrew Grieve (JIRA)" <ji...@apache.org> on 2013/07/03 22:43:20 UTC
[jira] [Commented] (CB-4024) About url-filter Feature
[ https://issues.apache.org/jira/browse/CB-4024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13699410#comment-13699410 ]
Andrew Grieve commented on CB-4024:
-----------------------------------
Please be aware that that code will be removed in 3.0 and instead replaced by UriResolver.java.
> About url-filter Feature
> ------------------------
>
> Key: CB-4024
> URL: https://issues.apache.org/jira/browse/CB-4024
> Project: Apache Cordova
> Issue Type: Wish
> Components: Android
> Affects Versions: 2.8.0
> Reporter: 胡争辉
> Assignee: Joe Bowser
> Priority: Trivial
>
> I noticed there is a comment in framework/src/org/apache/cordova/api/PluginManager.java Line 131 :
> // What is this?
> https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;a=blob;f=framework/src/org/apache/cordova/api/PluginManager.java;h=0a42b3abd2fc9c684728dbbdeb0cc62cd335c2b3;hb=HEAD#l131
> So I review the relative code. After a few hour, I find this code works:
> In config.xml
> <feature name="UrlFilter">
> <param name="android-package" value="com.daonao.test4.UrlFilter"/>
> <url-filter value="file:///android_asset/www/"/>
> </feature>
> In class com.daonao.test4.UrlFilter
> @Override
> @TargetApi(Build.VERSION_CODES.HONEYCOMB)
> public WebResourceResponse shouldInterceptRequest(String url) {
> ByteArrayInputStream stream = new ByteArrayInputStream(url.getBytes());
> return new WebResourceResponse("text/plain", "UTF-8", stream);
> }
> I am not sure these code is the right way, but it works now for me.
> For your information.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira