/**
  * Sets the content type based on the request content type and payload factory media type. This
  * should be called at the end before returning from the mediate() function.
  *
  * @param synCtx
  */
 private void setContentType(MessageContext synCtx) {
   org.apache.axis2.context.MessageContext a2mc =
       ((Axis2MessageContext) synCtx).getAxis2MessageContext();
   if (mediaType.equals(XML_TYPE)) {
     if (!XML_CONTENT_TYPE.equals(a2mc.getProperty(Constants.Configuration.MESSAGE_TYPE))
         && !SOAP11_CONTENT_TYPE.equals(a2mc.getProperty(Constants.Configuration.MESSAGE_TYPE))
         && !SOAP12_CONTENT_TYPE.equals(a2mc.getProperty(Constants.Configuration.MESSAGE_TYPE))) {
       a2mc.setProperty(Constants.Configuration.MESSAGE_TYPE, XML_CONTENT_TYPE);
       a2mc.setProperty(Constants.Configuration.CONTENT_TYPE, XML_CONTENT_TYPE);
       handleSpecialProperties(XML_CONTENT_TYPE, a2mc);
     }
   } else if (mediaType.equals(JSON_TYPE)) {
     a2mc.setProperty(Constants.Configuration.MESSAGE_TYPE, JSON_CONTENT_TYPE);
     a2mc.setProperty(Constants.Configuration.CONTENT_TYPE, JSON_CONTENT_TYPE);
     handleSpecialProperties(JSON_CONTENT_TYPE, a2mc);
   } else if (mediaType.equals(TEXT_TYPE)) {
     a2mc.setProperty(Constants.Configuration.MESSAGE_TYPE, TEXT_CONTENT_TYPE);
     a2mc.setProperty(Constants.Configuration.CONTENT_TYPE, TEXT_CONTENT_TYPE);
     handleSpecialProperties(TEXT_CONTENT_TYPE, a2mc);
   }
   a2mc.removeProperty("NO_ENTITY_BODY");
 }