Skip to content
Permalink
Browse files
[CXF-5554] Minor update
git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1567216 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Sergey Beryozkin committed Feb 11, 2014
1 parent 643a696 commit 02848d574a92a861503f636decef33c5a5e1c45e
Showing 1 changed file with 11 additions and 12 deletions.
@@ -132,18 +132,17 @@ public static void addParametersIfNeeded(MessageContext mc,
String enc = oAuthMessage.getBodyEncoding();
enc = enc == null ? "UTF-8" : enc;

if (params.isEmpty()) {
MediaType bodyMediaType = MediaType.valueOf(oAuthMessage.getBodyType());
if (MediaType.APPLICATION_FORM_URLENCODED_TYPE.isCompatible(bodyMediaType)) {
InputStream stream = mc != null
? mc.getContent(InputStream.class) : oAuthMessage.getBodyAsStream();
String body = FormUtils.readBody(stream, enc);
MultivaluedMap<String, String> map = new MetadataMap<String, String>();
FormUtils.populateMapFromString(map, PhaseInterceptorChain.getCurrentMessage(), body, enc, true,
request);
for (String key : map.keySet()) {
oAuthMessage.addParameter(key, map.getFirst(key));
}
if (params.isEmpty()
&& MediaType.APPLICATION_FORM_URLENCODED_TYPE.isCompatible(
MediaType.valueOf(oAuthMessage.getBodyType()))) {
InputStream stream = mc != null
? mc.getContent(InputStream.class) : oAuthMessage.getBodyAsStream();
String body = FormUtils.readBody(stream, enc);
MultivaluedMap<String, String> map = new MetadataMap<String, String>();
FormUtils.populateMapFromString(map, PhaseInterceptorChain.getCurrentMessage(), body, enc, true,
request);
for (String key : map.keySet()) {
oAuthMessage.addParameter(key, map.getFirst(key));
}
} else {
// This path will most likely work only for the AuthorizationRequestService

0 comments on commit 02848d5

Please sign in to comment.