Sar*_*byn 5 java grails chargify
我有一个GRAILS 3控制器,它Chargify使用这种格式从webservice()接收HTTP帖子(有效负载部分有大约100个具有大量子字段的条目):
POST / HTTP/1.1
Accept: */*; q=0.5, application/xml
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
X-Chargify-Webhook-Id: 81309408
X-Chargify-Webhook-Signature: xxxxxxxxxxxxx
X-Chargify-Webhook-Signature-Hmac-Sha-256: yyyyyyyyyyyyyy
Content-Length: 48
User-Agent: Ruby
X-Newrelic-Id: xxxxxx
X-Newrelic-Transaction: aaaaaaaaaaaaaa=
Host: myhost.test.it
id=81197881&event=statement_settled&payload[site][id]=12345&payload[site][subdomain]=test-sandbox
Run Code Online (Sandbox Code Playgroud)
有没有办法用GRAILS解析"有效载荷"部分并将其动态转换为POJO(或简单的散列图)?Chargify使用这种奇怪的格式无法识别GRAILS framework,我无法自动解析它.
有没有人帮我解析?感谢您的帮助.
你能试试这个吗?
def readChargify() {
String requestData = request.reader.text
def reqMap = org.grails.web.util.WebUtils.fromQueryString(requestData)
}
Run Code Online (Sandbox Code Playgroud)