专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 移动应用

Spring开始关切移动应用开发,发布Spring Mobile,Spring Android

发布时间:2010-05-30 21:28:23 文章来源:www.iduyao.cn 采编人员:星星草
Spring开始关注移动应用开发,发布Spring Mobile,Spring Android
近日,Roy Clarkson发布了Spring Mobile和Spring Android。


Spring Mobile


Spring Mobile 是 Spring MVC 的扩展,用来简化手机上的Web应用开发。



interceptor 定义的示例:
<interceptors>   
    <!-- On pre-handle, detect the device that originated the web request -->   
    <beans:bean class="org.springframework.mobile.device.mvc.DeviceResolvingHandlerInterceptor" />   
</interceptors>  

<interceptors>
    <!-- On pre-handle, detect the device that originated the web request -->
    <beans:bean class="org.springframework.mobile.device.mvc.DeviceResolvingHandlerInterceptor" />
</interceptors>


如果该设备不是移动设备,JSP模板也能有内容的呈现:


Please try again<c:if test="${!currentDevice.mobile}"> or <a href="<c:url value="/signup" />">sign up</a></c:if>  

Please try again<c:if test="${!currentDevice.mobile}"> or <a href="<c:url value="/signup" />">sign up</a></c:if> 


如果该设备是一个移动设备,基于Tiles的页面布局将会改变:

Java代码
<definition name="page" templateExpression="/WEB-INF/layouts/${currentDevice.mobile ? 'mobile/' : 'standard/'}page.jsp" />  

<definition name="page" templateExpression="/WEB-INF/layouts/${currentDevice.mobile ? 'mobile/' : 'standard/'}page.jsp" />  


Spring Android


Spring Android 是 Spring 框架的扩展,用于简化 Android 本地应用程序的开发。



针对Andriod的客户端,出现了不同的挑战。需要通过REST,与HTTPS服务器上的数据进行交流,因为数据是用户特定的,我们需要知道用户登录是不是使用了基本认证,而且我们也需要将用户名跟密码存储在设备上,所以我们选择了OAuth(查看更多关于OAuth的介绍)http://www.williamlong.info/archives/2185.html。


点击查看更多详情:http://blog.springsource.com/2010/11/19/spring-into-mobile-application-development/
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: