我想打电话给**
#emberjs#的#RestAdapter的#restservice#的发布方法#
**但默认情况下它会调用get方法。我需要评估如何从restadapter调用一个post方法,并在Ember Store中填充json
我的休息方法
@GET
@Consumes("application/json")
@Path("testmethods")
public String testmethods()
{
//String a= username;
//String b= password;
Gson json= new Gson();
String abc2=json.toJson("{\"testmethod\":[{\"id\":1,\"title\":\"Folder1\",\"author\":\"WP\"},{\"id\":2,\"title\":\"Folder2\",\"author\":\"WP2\"}]}");
return abc2;
}
我的余烬代码
App.Store =DS.Store.extend({
revision:12,
adapter: DS.RESTAdapter.extend({
url:"http://localhost:8080/StoreWebService/rest/storeservice",
})
});
显示错误
Uncaught TypeError: Object #<Object> has no method 'reject' ember-data.js:8831
DS.RESTAdapter.DS.Adapter.extend.ajax ember-data.js:8831
DS.RESTAdapter.DS.Adapter.extend.findAll ember-data.js:8756
DS.Store.Ember.Object.extend.fetchAll ember-data.js:2111
DS.Store.Ember.Object.extend.findAll ember-data.js:2096
DS.Store.Ember.Object.extend.find ember-data.js:1766
(anonymous function) ember-data.js:4194
MWCtWebapp.StoreappRoute.Ember.Route.extend.model app.js:9
superWrapper ember-1.0.0-rc.3.js:1044
Ember.Route.Ember.Object.extend.deserialize ember-1.0.0-rc.3.js:24232
collectObjects ember-1.0.0-rc.3.js:23395
proceed ember-1.0.0-rc.3.js:23419
collectObjects ember-1.0.0-rc.3.js:23405
Router.handleURL ember-1.0.0-rc.3.js:23072
Ember.Router.Ember.Object.extend.handleURL ember-1.0.0-rc.3.js:23836
Ember.Router.Ember.Object.extend.startRouting ember-1.0.0-rc.3.js:23820
Ember.Application.Ember.Namespace.extend.startRouting ember-1.0.0-rc.3.js:26922
Ember.Application.Ember.Namespace.extend.didBecomeReady ember-1.0.0-rc.3.js:26865
(anonymous function) ember-1.0.0-rc.3.js:4504
Ember.handleErrors ember-1.0.0-rc.3.js:411
invoke ember-1.0.0-rc.3.js:4502
invokeOnceTimer ember-1.0.0-rc.3.js:4955
(anonymous function) ember-1.0.0-rc.3.js:4504
Ember.handleErrors ember-1.0.0-rc.3.js:411
invoke ember-1.0.0-rc.3.js:4502
iter ember-1.0.0-rc.3.js:4572
RunLoop.flush ember-1.0.0-rc.3.js:4626
RunLoop.end ember-1.0.0-rc.3.js:4531
tryable ember-1.0.0-rc.3.js:4732
Ember.tryFinally ember-1.0.0-rc.3.js:1199
Ember.run.end ember-1.0.0-rc.3.js:4735
Ember.tryFinally ember-1.0.0-rc.3.js:1201
Ember.run ember-1.0.0-rc.3.js:4691
(anonymous function) ember-1.0.0-rc.3.js:26683
fire jquery-1.9.1.js:1037
self.fireWith jquery-1.9.1.js:1148
jQuery.extend.ready jquery-1.9.1.js:433
completed
答案 0 :(得分:1)
关于您的错误检查此答案,您使用了错误的文件组合:EmberJS TypeError: Object #<Object> has no method 'reject'
希望有所帮助