[
https://issues.apache.org/jira/browse/SQOOP-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14223088#comment-14223088
]
Qian Xu commented on SQOOP-1795:
--------------------------------
I try to get raw post data from {{request.getParameterMap()}}.
There are three cases:
1. No post data. The return value will be {{NULL}}.
2. Post data is in query string format (e.g. key1=a, val1=a1, key2-b, val2=b1,
key3=a, val3=value_of_duplicate_key). The return value should be
a=a1&b=b1&a=value_of_duplicate_key.
3. Post data is a raw string (in Sqoop's case a JSON). The return value should
be exactly the same JSON.
My first patch handles case 3 only, which is okay for Sqoop but not generic
enough. I'm re-working on it.
> Sqoop2: Retrieve Http post data in plausible manner
> ---------------------------------------------------
>
> Key: SQOOP-1795
> URL: https://issues.apache.org/jira/browse/SQOOP-1795
> Project: Sqoop
> Issue Type: Sub-task
> Reporter: Qian Xu
> Assignee: Qian Xu
> Priority: Minor
> Fix For: 1.99.5
>
>
> The situation of dealing with the post data is very tricky IMHO.
> 1. {{getRequest().getReader()}} must be called at the first place. As reading
> position cannot be reset, you might get unexpected result without notice.
> SQOOP-1784 is a case of the situation.
> 2. Sqoop client sends post data as a JSON object rather than query string
> format. Usually it'd suggest to wrap the JSON object as value, and key can be
> named as "jsonObject". The server will call
> {{ctx.getParameterValue("jsonObject")}} to get the value.
> I'd suggest to have a {{getRawPostData()}}, so that callers can put finger
> away from {{getReader()}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)