나는 일부 데이터를 사용하여 JQuery와에서 POST를 보내고,하지만 내 자바 스크립트를 통해 내가 얻을 :400 잘못된 요청
400 잘못된 요청 오류를 내가받을 포스터에서 그것을 시도
을 발사하지 REST
HTTP 상태 415 - 지원되지 않는 미디어 유형입니다. 요청 엔터티가 요청 된 방법에 대해 요청 된 리소스에서 지원하지 않는 형식이므로 서버가이 요청을 거부했습니다. 입니다
이@XmlRootElement
public class Data implements Serializable {
private String path;
private String rdf;
/**
* @return the path
*/
public String getPath() {
return path;
}
/**
* @param path the path to set
*/
public void setPath(String path) {
this.path = path;
}
/**
* @return the rdf
*/
public String getRdf() {
return rdf;
}
/**
* @param rdf the rdf to set
*/
public void setRdf(String rdf) {
this.rdf = rdf;
}
중 하나가 말해 줄 수 : 여기
@POST
@XmlElement(name = "data")
@Path("/update")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Produces(MediaType.APPLICATION_JSON)
public void update(Data data) {
...
}
내 데이터 개체입니다 :
여기
function doUpdate(path, rdf)
{
var encodedRdf = base64_encode(rdf);
var data = {"path": path, "rdf": encodedRdf};
var sUrl = "http://localhost:8080/browsing/services/RDF/update";
$.ajax({
type: "POST",
url: sUrl,
contentType: "application/json",
data: data,
dataType: "json",
async: false,
success: function parse(resp, status, xhr) {
$("#message").html("STATUS: " + xhr.status + " " + xhr.statusText + "\n" + resp);
$("#message").hide();
$("#login_message").html("<font color='green'><b>Record succesfully updated</b></font>d");
},
error: function(resp, status, xhr){
$("#message").html("ERROR: " + resp.status + " " + resp.statusText + "\n" + xhr);
$("#message").show();
}
});
}
내 REST 자원이다 : 여기
내 JQuery와있다 제발 제발?감사합니다.
나는 당신이 당신의 의도에 설명을 추가 할 때 그것이 더 많은 방문자들과 더 많은 방문자들에게 더 도움이 될 것이라고 생각한다. – reporter
죄송합니다. 끝냈다! – mzereba