JQuery POST,在休息服务上出现管道错误

时间:2014-12-24 23:28:23

标签: javascript jquery rest

我有一系列的休息服务,独立调用邮递员,他们工作正常。我用jquery调用getList非常好。当我执行POST来创建一个新对象时,它可以正常工作(就像在对象中创建的那样),但是却会获得响应,这是刚刚用id创建的对象。

$("#createEventSubmit").click(function(){
    createEvent();
});

function createEvent(){
    $.ajax({

        url: context + "/api/v1/organizer/event",
        contentType: 'application/json',
        data: formToJSON(),
        type: "POST",

        dataType : "json",

        success: function( json ) {
            console.log(json);
            setMessage("Event was created! " + json.id);
        },

        error: function( xhr, status, errorThrown ) {
            console.log( "Error: " + errorThrown );
            console.log( "Status: " + status );
            console.dir( xhr );
            setMessage("Sorry, your event was not created, please check your inputs.","ERROR");
        },

        complete: function( xhr, status ) {
            console.log( "Status: " + status );
        }
    });
}

视觉上没有任何事情发生,没有任何东西被放到控制台。应用服务器上的错误是:

18:17:47,193 INFO  [com.herdcat.web.api.v1.orgnaizer.event.OrganizerEvent] (default task-48) New Event Created: 60947792-0076-42d6-91d2-3d4144a40f5a
18:17:47,195 ERROR [io.undertow.request] (default task-48) UT005023: Exception handling request to /hc/api/v1/organizer/event: javax.servlet.ServletException: org.jboss.resteasy.spi.UnhandledException: Response is committed, can't handle exception
    at org.apache.shiro.web.servlet.AdviceFilter.cleanup(AdviceFilter.java:196) [shiro-web-1.2.3.jar:1.2.3]
Caused by: java.io.IOException: Broken pipe
    at sun.nio.ch.FileDispatcherImpl.write0(Native Method) [rt.jar:1.7.0_51]

奇怪的是GET jquery设置完全一样。非常绿色到jquery所以任何建议对我来说都是好建议。并且对象确实被创建了,它似乎无法处理响应。

提前致谢。

0 个答案:

没有答案