首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

JBoss Resteasy 二之URL匹配

2012-12-27 
JBoss Resteasy 2之URL匹配在上一篇helloworld中,简单介绍了入门,本文讲解其URL匹配,也是REST中很重要的一

JBoss Resteasy 2之URL匹配
  在上一篇helloworld中,简单介绍了入门,本文讲解其URL匹配,也是REST
中很重要的一环
看例子:

  

可以看到,还支持正则表达式。所以,容易看出:

1) “/users/999”
返回:getUserById is called, id : 999

2) /users/username/aaa”
  不匹配

3) users/books/999”
  返回:getUserBookByISBN is called, isbn : 999

再看例子:
 

则“/users/22667788 匹配
  getUserById is called, id : 22667788

多个参数传入的例子:
 

则:
“/users/2011/06/30”
输出:
   getUserHistory is called, year/month/day : 2011/6/30

热点排行