RAP1.3
這篇文章主要是寫一下在RAP中運用EntryPoint and Servlet的經驗。
- EntryPoint:是RAP應用程式的入口,擴充點為 org.eclipse.rap.ui.entrypoint
一個RAP外掛程式可以有多個entryPoint ,
選取其中一個擴充點資訊如下:
- 要想啟動EntryPoint還需要servlet,通過擴充點 org.eclipse.rap.ui.branding 可以設定預設啟動的entryPoint,如:
設定如下:
- 啟動RAP,如果是在Eclipse中直接launch應用,IE中的網址應該是: http://[Host]:[Port]/[servlet]?startup=[entrypoint],其中以上面的執行個體來說,地址為: http://locahost:10086/test?startup=entrypoint1 其中連接埠號碼可以預設值。這裡要說明的是,因為已經為servlet為test的設定了預設的entrypoint,所以在RAP應用已經啟動的前提下,直接在IE地址欄中輸入 : http://locahost:10086/test 此時會根據defaultEntrypointId設定(如示)也可以跳轉到entrypoint1應用中。
其他的情況可以類推,你可以建立多個branding,建立多個entrypoint。
- 有時候設定預設的entrypoint不能滿足IE地址欄中的靈活變通,此時可能需要地址的重新導向,為此RAP中也提供了相應的重新導向路徑的擴充點:org.eclipse.equinox.http.registry.servlets ,
詳細設定如下:
其中alias便是IE地址欄中[servlet]的替代符,即sevlet可以轉義為“/”,真正的實現跳轉需要在代碼中實現
即在IE地址欄中輸入
http://localhost:10086/path
==>redirect to==>
http://localhost:10086/test?startup=entryPoint2
其中如果在alias設定為"/files",則在IE地址欄中輸入
http://localhost:10086/files/path
==redirect to==>
http://localhost:10086/files/test?starup=entryPoint2
最後要說的是,entrypoint , branding and servlet 配合使用可以在多entrypoint的應用下實現IE地址的不同需求。
僅供參考!