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地址栏中输入
==>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地址的不同需求。
仅供参考!