Jersey Restlet and Apache CXF

Jersey  Restlet  and  Apache CXF 都是现了RESTFUL 的支持.

Jersey 实现了jsr 311继续使用 jax-ws式样的使用annotation 完成对url 的控制。
下面的code很熟悉吧
@HttpMethod("GET")
@UriTemplate("{userId}.txt")
@ProduceMime("text/plain")
public String sayHello(@UriParam("userId") String userId) {
return "Hello " + userId;
}
Restlet使用的要自己使用code把消息dispach的相应的restlet上。
public class RestletMapper {
private Map restMap = new HashMap< String , Restlet>();

public void init( Router router){
for( Object key : restMap.keySet() ){
router.attach( (String)key , (Restlet) restMap.get(key));
}
}

public void setRestMap( HashMap< String , Restlet> map){
this.restMap = map;
}
}
Router
相比之下,感觉jersey的实现更加简洁, Restlet的控制能力更强。
Apache CXF  对 REST的sytle支持的比较全面,不过现在
  1. JAX-RS (JSR-311): CXF has an initial implementation of JAX-RS (JSR-311): Java API for RESTfulWeb Services. This provides a more standard way to build RESTful services in JAVA.
  2. HTTP Binding: The HTTP binding provides a flexible way of creating resources and mapping them to operations in your service. This can currently be done via annatotations or a convention based mapping.
  3. JAX-WS Provider and Dispatch: It is possible to create simple RESTful services with the JAX-WS Provider and Dispatch APIs. It is not as flexible as the HTTP binding, but does use standard APIs.

可惜,还没有真正去用一下。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值