【发布时间】:2014-11-04 11:52:27
【问题描述】:
我想从前端应用程序向后端发送一个带有复杂 JSON 对象的 POST 请求。
后端
我有一个名为 NotificationService 的类和一个名为 writeNotification 的方法,如下所示:
@POST
@Path(SERVICE_PATH_WRITENOTIFICATION)
public Response writeNotification(@FormParam("notification") String notification)
前端侧
我发送这个:
var obj = [ {
to : $scope.formComboDestinatari.listaDestinatari,
subject : $scope.formOggetto,
date : "xxx",
body : $scope.formTesto,
type : $scope.formComboTipologia
} ];
如果我使用这种语法:
Restangular.one('serverpath/writenotification').post(obj);
当我尝试发送请求时出现此错误:
500 internal server error
如果我使用这种语法:
Restangular.one('serverpath').post('writenotification', obj);
400 Bad request
我不明白我的错在哪里。
【问题讨论】:
标签: java restangular