我按照这个关于开发 RESTful Web 服务的基本 NetBeans 教程进行操作。我能够成功地为客户数据库创建和测试 Restful Web 服务。
但是,在为这个 RESTful Web 服务创建 Restful JavaScript Client 时,我得到一个空表输出。似乎 TestStubs.html JavaScript 代码部分中的 app.getResources() 调用使用 app.getResources() 调用返回了一个空数组,因此资源数组上的循环永远不会运行。
这是资源为空的 TestStubs.html 的 JavaScript 部分:
var app = new CustomerDBRest('http://localhost:8080/CustomerDBRest/webresources');
var resources = app.getResources(); //returns an empty array
for (i = 0; i < resources.length; i++)
{
...
}
这是 localhost:8080/CustomerDBrestJS/customerDBrest.client/TestStubs.html 的截图