我想打电话给**
#restservice#的post方法来自emberjs的#RESTAdapter#
** 但默认情况下它调用 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