现在的位置: 首页 > 综合 > 正文

rest2 helloworld

2013年02月06日 ⁄ 综合 ⁄ 共 417字 ⁄ 字号 评论关闭

 

public class FirstRest2 extends ServerResource {

public static void main(String[] args) throws Exception {  

     // Create the HTTP server and listen on port 8182  

     new Server(Protocol.HTTP, 8185, FirstRest2.class).start();  

  }

@Get

public String toString(){

return "hello, world";  

}

}

 

 

restlet2继承serverResource不是1.0版本的resource,put,get,delete,post采用annotation标识,采用pojo方式,降低藕合度,运行例子时添加jar文件只需要添加org.restlet.jar,如果添加所有restlet的lib中的jar文件将的报未找到文件错误,不知什么原因。

【上篇】
【下篇】

抱歉!评论已关闭.