private void parseRequestBodyUsing(HttpRequestBodyParser parser) { if (U.notEmpty(body())) { Map<String, ?> bodyData = null; try { bodyData = parser.parseRequestBody(this, body); } catch (Exception e) { Log.error("Couldn't parse the request body! Please make sure the correct content type is specified in the request header!", e); } if (bodyData != null) { posted.putAll(bodyData); } } }
private void parseRequestBody() { if (U.isEmpty(body())) return; String contentTypeHeader = header("Content-Type", "application/json"); if (contentTypeHeader.startsWith("application/json")) { parseRequestBodyUsing(custom().jsonRequestBodyParser()); } else if (contentTypeHeader.startsWith("application/xml")) { parseRequestBodyUsing(custom().xmlRequestBodyParser()); } else { throw U.rte("Couldn't parse the request body - unsupported content type: " + contentTypeHeader); } }
private void parseRequestBodyUsing(HttpRequestBodyParser parser) { if (U.notEmpty(body())) { Map<String, ?> bodyData = null; try { bodyData = parser.parseRequestBody(this, body); } catch (Exception e) { Log.error("Couldn't parse the request body! Please make sure the correct content type is specified in the request header!", e); } if (bodyData != null) { posted.putAll(bodyData); } } }
private void parseRequestBody() { if (U.isEmpty(body())) return; String contentTypeHeader = header("Content-Type", "application/json"); if (contentTypeHeader.startsWith("application/json")) { parseRequestBodyUsing(custom().jsonRequestBodyParser()); } else if (contentTypeHeader.startsWith("application/xml")) { parseRequestBodyUsing(custom().xmlRequestBodyParser()); } else { throw U.rte("Couldn't parse the request body - unsupported content type: " + contentTypeHeader); } }