【发布时间】:2012-04-24 08:42:42
【问题描述】:
尊敬的 Stackoverflow 用户, 谁能给我一个简单的例子,在netbeans中有2个或更多@get和@put的restful webservice?任何简单的纯文本示例就足够了。它不应该包括任何数据库! 如果有人可以帮助我,我会非常高兴。 我尝试了一些方法,但没有成功,这是代码
@Path("/simple")
public class SimpleResource_1 {
@Context
private UriInfo context;
@GET
@Produces("text/plain")
public String getText() {
return "hello world";
}
@Path("/simple/simple1")
public class SimpleResource_11 {
@Context
private UriInfo context;
@GET
@Produces("text/plain")
public String getText1(){
return "hi";
}
}
此代码出现运行时错误,但没有任何编译错误。 我做对了吗?还是我错过了什么!!
提前致谢!
干杯!
【问题讨论】:
-
@MarioDeSchaepmeester 我使用 javax.ws,谢谢回复。
标签: web-services http rest get