It seems that some of the JSON handling behaviour has changed between 1.0.3 and 1.1 RC1.
In 1.0.3.2 I could have an action:
public static void invoke(String message)
and then have the message parameter set with the following AJAX call:
var jsonData=JSON.stringify({"message": "hello" });
$.ajax({
type: "post",
contentType: "application/json",
url: "/Service/invoke",
data: jsonData,
success: responseHandler,
processData: false,
dataType: "json"
});
In 1.1RC1 the message parameter does not get set.
Is the change in behaviour desired?
Thanks,
Rob
It's probably not linked to your problem but I don't think you need to
stringify your JSON object, jQuery will do that for you if you just
pass an object. That way it would work in browsers that don't have the
JSON object.
Now could you post a full Play app that works in 1.0 but not 1.1? The
best would be to trim it down so only the used code is included. At
least the Java code of /Service/invoke would help.
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>
--
Erwan Loisant
Just putting together the simple app now.
in my tests on chrome with old versions of jquery I did need the JSON.stringify. The json2.js http://www.json.org/js.html has the implementation of json.stringify for broken browsers.
I'll create a bug for you.
Regards,
Rob
Rob
--
Guillaume Bort, http://guillaume.bort.fr
For anything work-related, use g...@zenexity.fr; for everything else,
write guillau...@gmail.com
fwiw I ended up writing a custom plugin to handle json binding in 1.0. (after some of the guys on my time fixed up my threading bugs it works pretty well :)).
The plugin uses the gson code to bind to the parameters, skipping the multiple parser layers in the 1.0 implementation, instead using the beforeInvocation(), bind(), and invocationFinally() plugin hooks to do the binding.
Rob
>>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com
>>> .
>>> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en
>>> .
>>>
>>>
>>
>>
>>
>> --
>> Guillaume Bort, http://guillaume.bort.fr
>>
>> For anything work-related, use g...@zenexity.fr; for everything else,
>> write guillau...@gmail.com
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "play-framework" group.
>> To post to this group, send email to play-fr...@googlegroups.com.
>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com
>> .
Rob
>>>>>> To post to this group, send email to play-fr...@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
>>>>>> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Erwan Loisant
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups "play-framework" group.
>>>>> To post to this group, send email to play-fr...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
>>>>> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups "play-framework" group.
>>>> To post to this group, send email to play-fr...@googlegroups.com.
>>>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
>>>> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Guillaume Bort, http://guillaume.bort.fr
>>>
>>> For anything work-related, use g...@zenexity.fr; for everything else,
>>> write guillau...@gmail.com
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "play-framework" group.
>>> To post to this group, send email to play-fr...@googlegroups.com.
>>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
>>> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups "play-framework" group.
>> To post to this group, send email to play-fr...@googlegroups.com.
>> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.