这是我的角度app.js代码
$http({
method: 'GET',
url: 'http://localhost:8080/GngWebservice/rest/GngService/FeetToInch'
//webservice url
}).success(function(data, status) {
$scope.status = status;
$scope.data = data;
}).
error(function(data, status) {
console.log(data);
$scope.data = data || "Request failed";
$scope.status = status;
});
和我的休息网络服务(java)使用jersey)方法是:
@Path("/FeetToInch")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getoutput() throws JSONException {
JSONObject json=new JSONObject();
JSONObject HEADER=new JSONObject();
JSONObject RESPONSE=new JSONObject();
json.put("name", "hello");
HEADER.put("status","200");
RESPONSE.put("data", "hello");
json.append("HEADER", HEADER);
json.append("RESPONSE", RESPONSE);
String results=""+json;
System.out.println(results);
return Response.status(200).entity(results).build();
}
希望发送json作为响应,但它始终显示失败 任何机构都可以告诉我如何找到发生的错误