首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

JAX-RS入门 3 :细节

2012-11-04 
JAX-RS入门 三 :细节???????@Path(/customers) ??public?class?CustomerDatabaseResource?{ ???????prot

JAX-RS入门 三 :细节
?JAX-RS入门 3 :细节?JAX-RS入门 3 :细节?JAX-RS入门 3 :细节?JAX-RS入门 3 :细节?JAX-RS入门 3 :细节?JAX-RS入门 3 :细节?

    @Path("/customers") ??public?class?CustomerDatabaseResource?{ ???????protected?CustomerResource?europe?=?new?CustomerResource(); ???????protected?FirstLastCustomerResource?northamerica?= ?????????????????????????????????????new?FirstLastCustomerResource(); ?????????@Path("{database}-db") ???????public?Object?getDatabase(@PathParam("database")?String?db)?{ ?????????????if?(db.equals("europe"))?{ ??????????????????return?europe; ?????????????} ??????????????else?if?(db.equals("northamerica"))?{ ??????????????????return?northamerica; ??????????????} ???????????????else?return?null; ?????????} ??}???

?

这里返回值是一个Object,已经不再局限于CustomerResource类了。JAX-RS会检查这个实例,以决定怎么分发请求。

热点排行