【问题标题】:Android: Matching host pattern in an Intent FilterAndroid:在意图过滤器中匹配主机模式
【发布时间】:2016-02-10 00:21:42
【问题描述】:

我有以下网址:

http://api.modarchive.org/downloads.php?moduleid=50479#ngs_cvrg.xm

我想做的是匹配所有在主机名中包含“mod”的.php URL。 android:host 只允许 1 个通配符,我需要 2 个。

我尝试修改 android:pathPattern 如下:

<data android:pathPattern=".*mod.*\\.php"/>

上述说法有什么问题?

如果我要为此编写一个“普通”文件通配符,我会使用:

 *mod*.php 

..但 Android pathPattern 语法不同。

看来我正在尝试做的事情是不可能的:

"The URL consists of four parts: it has each of the four properties scheme, host, port, path corresponds to the URI part.

       For example: content://com.wjr.example1:121/files

       Part scheme: content
       Part host: com.wjr.example1
       Part port: 121
       Part path: files 
"

那么.. 我怎样才能匹配任何包含“mod”的主机(例如 mods、modules、modarchive、modheaven 等)?

【问题讨论】:

    标签: android android-intent intentfilter


    【解决方案1】:

    你不能这样做。据推测,这可以防止任何应用程序为 URL 注册本质上的“批量”拦截器,并使可能会看到一些奇怪的应用程序要求处理各种 URL 的用户感到困惑。您必须按特定名称注册每一个。

    【讨论】:

    • 是的,您无法匹配 URL 参数,这令人沮丧。如果我可以为“?”后面的东西添加一个模式在一个 PHP URL 中,我所有的麻烦都将迎刃而解。希望这个网站是我必须迎合的例外:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-14
    • 1970-01-01
    • 2021-11-25
    • 1970-01-01
    相关资源
    最近更新 更多