android intent-infliter 過濾驗證

來源:互聯網
上載者:User

標籤:

過濾分為四大類驗證

<action>

<category>

<data>

<ssp>

0.四大組件可以申明多個intent-fliter標籤。

1. Action驗證是必選項,如果沒有Action的話,驗證是失敗的。Action驗證是或者的關係,即是滿足一個就通過驗證。

eg:

<intent -infliter >

         <actionandroid:name="Action1"/>

         <actionandroid:name="Action2"/>

         <actionandroid:name="Action3"/>

</intent -infliter ><

 

 

action = "Action1"

通過驗證

 

2.category是可選項,驗證規則是在某個intent-fliter標籤申明了多個標籤的話,則請求驗證的intent的所有category都必須是當前請求驗證的intent-fliter標籤category的子集。

 

<intent -infliter >

         <category  android:name=" category 1"/>

         <category  android:name=" category2"/>

         <category  android:name=" category3"/>

</intent -infliter ><

 

eg2:

Intent intent  = new Intent();

intent .addCategory("category1");

intent .addCategory("category2");

通過驗證

 

eg3:

Intent intent  = new Intent();

intent .addCategory("category1");

intent .addCategory("category2");

intent .addCategory("category4");

沒有通過驗證

 

 

 

 

 

3.data驗證。data的格式 :    scheme://host:port/path

         3.1:驗證必須是從左至右開始逐個驗證不允許跳躍驗證。

            eg:

         3.2:scheme是必須要有的。

         3.3:驗證的屬性 

a                                            android:scheme=""         

b                                            android:host=""

c                                             android:port=""

d                                            android:path=""

e                                            android:pathPattern=""

f                                             android:pathPrefix=""

g                                            android:mimeType=""

h                                            android:ssp=""                            4.4 plus

i                                              android:sspPattern=""           4.4 plus

j                                              android:sspPrefix=""               4.4 plus

 

         對於a、b、c、d他們的關係是與的關係,只有全部滿足才算通過。

         對於d、e、f他們的關係是或的關係,通過任意一個都算通過。

         對於uri(a、b、c、d、e、f)和mimeType的關係是與的關係。只有全部滿足才算通過。記住如果請求驗證的的Intent含有uri或者mimeType,而標籤含有uri或mimeType那麼請求驗證是失敗的。反之也失敗的。

4. ssp 見https:/zybuluo.com/flyouting/note/18525

注1:path 是用於完整路徑匹配. eg:  /index.jsp

注2:pathPattern是路徑匹配模式有兩種形式  "*" 、 ".*"

         *代表的是*前的一個字元有0個或多個。 ab*c匹配  ac abc abbc abbbc

         .*代表的是 0個或多個字串。 ab*c匹配  abc  abec  abffc abuuuuc

注3:pathPrefix是用於路徑首碼匹配.  /in  匹配   /in.jsp index.jsp  .....

注4:host也可以用萬用字元不過host只能包含一個*的萬用字元,而不能包含其他字元。


android intent-infliter 過濾驗證

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.