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

介绍了SpringMobile和SpringAndroid两个框架,分别用于简化手机Web应用和Android本地应用的开发过程。SpringMobile通过拦截器识别设备类型并调整响应内容,而SpringAndroid则提供了与服务器交互的便捷方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

近日,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的介绍)[url]http://www.williamlong.info/archives/2185.html[/url]。


点击查看更多详情:[url]http://blog.springsource.com/2010/11/19/spring-into-mobile-application-development/[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值