On 06/10/2013 02:17 PM, Martin Grigorov wrote:
On Mon, Jun 10, 2013 at 3:11 PM, Andrea Del Bene <an.delb...@gmail.com>wrote:
The code is quite simple as it's basically a prototype. Java code:
@Override
public void respond(Attributes attributes) {
StringValue action = attributes.getParameters().**get(SEGMENT);
attributes.getResponse().**write(calculateResponse(**action,
attributes));
}
private String calculateResponse(StringValue action, Attributes
attributes) {
String response = "{{" +
"\"Herausgeber\": \"Xema\", " +
"\"Nummer\": \"1234-5678-9012-3456\"}}";
Why there are doubled '{' and '}' ?
Just the result of some bad ideas :)
if(action.toString().equals(**SAVE)){
IRequestParameters requestParameters = attributes.getRequest().
**getRequestParameters();
response = requestParameters.**getParameterValue("**
teamCalendarJson").toString();
}
System.out.println(response);
return response;
}
As you said the error could be a missing settings for content-type
header. Should I use "application/json"?
Yes.
I've tried with :
@Override
public void respond(Attributes attributes) {
StringValue action = attributes.getParameters().get(SEGMENT);
WebResponse response = (WebResponse) attributes.getResponse();
response.setContentType("application/json");
response.write(calculateResponse(action, attributes));
}
private String calculateResponse(StringValue action, Attributes
attributes) {
String response = "{" +
"\"Herausgeber\": \"Xema\", " +
"\"Nummer\": \"1234-5678-9012-3456\"}";
if(action.toString().equals(SAVE)){
IRequestParameters requestParameters =
attributes.getRequest().getRequestParameters();
response =
requestParameters.getParameterValue("teamCalendarJson").toString();
}
System.out.println(response);
return response;
}
but it still fail calling the error function of getJSON.....
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org