António Mota
2011-12-14 17:56:58 UTC
I'm having a strange situation here, I'm invoking a Jersey resource using a
XMLHttpRequest like this:
xhReq.open("POST", "/rest/imaging/annotations", false);
xhReq.setRequestHeader("Content-Type","application/json");
xhReq.setRequestHeader("Content-length", annotations.toString().length);
xhReq.setRequestHeader("Connection", "close");
xhReq.send(annotations);
if(xhReq.status==204){
return;
}else{
alert(xhReq.status+xhReq.responseText);
}
This is working, not only because I have no alert() but because I can see
the code on the server being correctly invoked. It's defined like this:
@POST
@Path("/imaging/annotations")
@Consumes({ "application/xml", "application/json" })
public void saveImageAnnotations(ImageAnnotationImpl[] imageAnnotations);
But, although it is working OK, I always get from Tomcat a
Method Not Allowed The specified HTTP method is not allowed for the
requested resource (Method Not Allowed).
I have no more calls to the server after this one, so I can;t understand
where this error comes. Any idea?
Thanks in advance.
XMLHttpRequest like this:
xhReq.open("POST", "/rest/imaging/annotations", false);
xhReq.setRequestHeader("Content-Type","application/json");
xhReq.setRequestHeader("Content-length", annotations.toString().length);
xhReq.setRequestHeader("Connection", "close");
xhReq.send(annotations);
if(xhReq.status==204){
return;
}else{
alert(xhReq.status+xhReq.responseText);
}
This is working, not only because I have no alert() but because I can see
the code on the server being correctly invoked. It's defined like this:
@POST
@Path("/imaging/annotations")
@Consumes({ "application/xml", "application/json" })
public void saveImageAnnotations(ImageAnnotationImpl[] imageAnnotations);
But, although it is working OK, I always get from Tomcat a
Method Not Allowed The specified HTTP method is not allowed for the
requested resource (Method Not Allowed).
I have no more calls to the server after this one, so I can;t understand
where this error comes. Any idea?
Thanks in advance.