I using jquery to post the request with some content and expecting a
JSON-format response
here is my code..
$.post("/socialize/tags;addTag.json",{contentType:"TOPIC",
resourceId:1,
tags:"tag"},function(data){
$(this).hide();
loadTagsCallback(data);
},"json");
The response is a 500 error.. below is the details from firebug
I have debuging and at the line
org.apache.struts2.rest.handler.JsonLibHandler.toObject(JsonLibHandler.java:52)
the inputStream seems empty...
Is there any example to Using Rest with json content within a post request?
http://localhost:8080/socialize/tags;addTag.json
Response Headers
Server Apache-Coyote/1.1
Content-Type text/html;charset=utf-8
Transfer-Encoding chunked
Date Mon, 06 Oct 2008 06:38:15 GMT
Connection close
Request Headers
Host localhost:8080
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3)
Gecko/2008092417 Firefox/3.0.3
Accept application/json, text/javascript, */*
Accept-Language en,en-us;q=0.7,zh-cn;q=0.3
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Connection keep-alive
Content-Type application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With XMLHttpRequest
Referer http://localhost:8080/forum/topics/22538
Content-Length 47
Cookie JSESSIONID=345383603A39CFE0B4D7F54AB1A1DE41
Exception report</p><p>message <u></u></p><p>description
<u>The server encountered an internal error () that prevented it from
fulfilling this request.<
/u></p><p>exception <pre>net.sf.json.JSONException: A JSONObject text must
begin with '{' at character
0 of
net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:512)
net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:881)
net.sf.json.JSONObject._fromString(JSONObject.java:1102)
net.sf.json.JSONObject.fromObject(JSONObject.java:175)
net.sf.json.JSONObject.fromObject(JSONObject.java:145)
org.apache.struts2.rest.handler.JsonLibHandler.toObject(JsonLibHandler.java:52)
org.apache.struts2.rest.ContentTypeInterceptor.intercept(ContentTypeInterceptor.java:67)
-----
Blog: http://www.ryanwong.name
Can Use: English, Chinese
--
View this message in context:
http://www.nabble.com/Using-Rest-with-JSON%2C-post-error-%28jquery%29-tp19832868p19832868.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]