熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java開源技術 >> 正文

Spring3.0新特征-Restful support MVC[1]

2022-06-13   來源: Java開源技術 

  最近在Spring官網上發現Spring 發布不久Spring項目已經是開始進行了

  包括很多新功能如標題中提到的Restful的支持還有Servlet的支持等

  大概總結了一下Spring中會包括以下一些新特性

   Full scale REST support by means of additions to the Spring MVC API already pretty detailed and apparently going to be included in the first milestone release

   Support for Unified EL (as seen in Spring Web Flow) very likely part of but no details given

   Annotation support for declaring factory methods as above

   Support for Portlet (JSR including resource requests (ResourceServingPortlet) as above

   Preparations for Servlet specification sounded a lot like architectural preparations not visible to the consumer

   Something to fill the gap between Spring Web Flow and Spring MVC that sounded very vague

   Inclusion (probably generalisation) of the repeat retry and resume semantics provided by Spring Batch was only hinted at no details given

   Inclusion of the OXM support provided by Spring WS sounded pretty definitive but no details given

   Some kind of site definition language for the web stack no idea whether this is more than a rumour

   Modelbased validation for use both in server and client as above

  下面我們具體介紹一下Restful該特性

  剛才我也提到了Spring是基於其目前提供的Spring MVC框架上引入對Rest的支持這樣使其可以很好的融合到Spring中

  下面有一段代碼大家看了會更有體會

  先看一下如何發布Rest風格的服務接口

@RequestMapping(value = /gadgets/{id}
       method = RequestMethodGET)
public View getGadget(@PathParam String id) {
   // 功能是根據 id 查詢 Gadget對象
   // 返回View對象
}
 

[]  []  


From:http://tw.wingwit.com/Article/program/Java/ky/201311/29135.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.