Skip to content

Commit a8fd43c

Browse files
AXIS2-6046 we supported a null content-type and null charSetEnc up until 1.7.9, so support that now
1 parent 409466a commit a8fd43c

1 file changed

Lines changed: 24 additions & 16 deletions

File tree

  • modules/transport/http/src/main/java/org/apache/axis2/transport/http

modules/transport/http/src/main/java/org/apache/axis2/transport/http/HTTPSender.java

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -441,30 +441,38 @@ private void obtainHTTPHeaderInformation(Request request, MessageContext msgCont
441441
HTTPConstants.MC_HTTP_STATUS_CODE,
442442
Integer.valueOf(request.getStatusCode()));
443443

444+
// AXIS2-6046 , we supported a null content-type and null charSetEnc up until 1.7.9,
445+
// so let's support that here now
444446
String contentTypeString = request.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
447+
String charSetEnc = null;
445448
if (contentTypeString != null) {
446449
ContentType contentType;
447450
try {
448451
contentType = new ContentType(contentTypeString);
449452
} catch (ParseException ex) {
450453
throw AxisFault.makeFault(ex);
451454
}
452-
String charSetEnc = contentType.getParameter(HTTPConstants.CHAR_SET_ENCODING);
453-
MessageContext inMessageContext = msgContext.getOperationContext().getMessageContext(
454-
WSDLConstants.MESSAGE_LABEL_IN_VALUE);
455-
if (inMessageContext != null) {
456-
inMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentTypeString);
457-
inMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
458-
} else {
459-
// Transport details will be stored in a HashMap so that anybody
460-
// interested can
461-
// retrieve them
462-
Map<String,String> transportInfoMap = new HashMap<String,String>();
463-
transportInfoMap.put(Constants.Configuration.CONTENT_TYPE, contentTypeString);
464-
transportInfoMap.put(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
465-
// the HashMap is stored in the outgoing message.
466-
msgContext.setProperty(Constants.Configuration.TRANSPORT_INFO_MAP, transportInfoMap);
467-
}
455+
charSetEnc = contentType.getParameter(HTTPConstants.CHAR_SET_ENCODING);
456+
}
457+
458+
if (contentTypeString == null) {
459+
log.debug("contentType and charSetEnc detected as null, proceeding anyway");
460+
}
461+
462+
MessageContext inMessageContext = msgContext.getOperationContext().getMessageContext(
463+
WSDLConstants.MESSAGE_LABEL_IN_VALUE);
464+
if (inMessageContext != null) {
465+
inMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentTypeString);
466+
inMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
467+
} else {
468+
// Transport details will be stored in a HashMap so that anybody
469+
// interested can
470+
// retrieve them
471+
Map<String,String> transportInfoMap = new HashMap<String,String>();
472+
transportInfoMap.put(Constants.Configuration.CONTENT_TYPE, contentTypeString);
473+
transportInfoMap.put(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
474+
// the HashMap is stored in the outgoing message.
475+
msgContext.setProperty(Constants.Configuration.TRANSPORT_INFO_MAP, transportInfoMap);
468476
}
469477

470478
Map<String,String> cookies = request.getCookies();

0 commit comments

Comments
 (0)