http .success()方法从未被调用,即使Web服务被命中

时间:2015-03-23 11:59:35

标签: java angularjs

这是我的角度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作为响应,但它始终显示失败  任何机构都可以告诉我如何找到发生的错误

0 个答案:

没有答案