`

rest2 helloworld

    博客分类:
  • rest
 
阅读更多

 

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文件将的报未找到文件错误,不知什么原因。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics