1

REST 呼び出しの送信中に、JSON 応答データで奇妙な応答が得られます。firebug で、応答ステータスが問題ないことを確認できますが、ポスターを試しても正常に動作しますが、本文は空です。これが私のJQuery呼び出しです:

var urlPath = "http://localhost:8080/coreserver/rest";

function totalAccountCount()
{
    $.ajax({
        type: "GET",
        url: urlPath + "/summary/totalAccountCount",
        dataType: "json",

        success: function (resp) {
           var rowText = "<tr><td>Total Accounts</td><td>" + resp.wrapper.item + "</td></tr>";
           $(rowText).appendTo(tbody);
           //loadCustomers(resp); 
           alert("STATUS: " + xhr.status + " " + xhr.statusText);
        },
        error: function(xhr, textStatus, errorThrown){  
             alert("Error: fails"); 
             //$("#message").html(resp.e  + " - STATUS: " + xhr.status + " " + xhr.statusText);

           } 
    });
}

デバッグ中は、成功ブランチではなく、エラー ブランチに移動します。ここに私のリソースがあります:

@GET
@Path("/totalAccountCount")
@Produces({MediaType.APPLICATION_JSON})
public JaxbWrapper<Integer> getTotalAccountCount() {
    return new JaxbWrapper<Integer>((int)this.accountStore.count());
}

で私の応答を読むのJaxbWrapperはおそらく間違っていることはわかっていますが、まったく成功していないので、今のところこれが機能することを確認したいと思います。

助けていただければ幸いです。前もって感謝します。

4

1 に答える 1