Jochen Kemnade created TAP5-2432:
------------------------------------
Summary: It should be easy to send data as JSON instead of
form-encoded
Key: TAP5-2432
URL: https://issues.apache.org/jira/browse/TAP5-2432
Project: Tapestry 5
Issue Type: Wish
Components: tapestry-core
Affects Versions: 5.4
Reporter: Jochen Kemnade
Priority: Minor
When data is sent from the client to the server via {{t5/core/ajax}} the data
is transferred as {{application/x-www-form-urlencoded}} content.
{{OnEventWorker}} and {{@RequestParameter}} are tailored to that transfer
method.
Sometimes it is more appropriate to send data as {{application/json}}, but if
you do that, if I'm not missing something, things are much more complicated on
the server side: You have to {{@Inject}} the {{HttpServletRequest}}, acquire a
{{ServletInputStream}}, read that into a {{String}}, have that parsed into a
{{JSONObject}} and retrieve the data from that. You also have to do all the
error-handling yourself.
Tapestry should be able do some of that for you.
Maybe we can start by allowing for something like
{code}
@Inject
@RequestBody
private JSONObject requestJson;
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)