httpContentType is NULL
431772
private static String getContentTypeEncoding(final String httpContentType) {
        String encoding = null;
        if (httpContentType != null) {
            final int i = httpContentType.indexOf(";");
            if (i > -1) {
                final String postMime = httpContentType.substring(i + 1);
                final Matcher m = CHARSET_PATTERN.matcher(postMime);
                if (m.find()) {
                    encoding = m.group(1);
                }
                if (encoding != null) {
                    encoding = encoding.toUpperCase(Locale.ENGLISH);
                }
            }
            if (encoding != null && (encoding.startsWith("\"") && encoding.endsWith("\"") || encoding.startsWith("'") && encoding.endsWith("'"))) {
                encoding = encoding.substring(1, encoding.length() - 1);
            }
        }
        return encoding;
    }
594986
public void setContentType(String type) {
		checkContentType(type);
		checkCommitted();
		String name = getCorrectHeaderName(ContentTypeHeader.NAME);
		try {
			Header h = SipFactoryImpl.headerFactory.createHeader(name, type);
			this.message
					.removeHeader(getCorrectHeaderName(ContentTypeHeader.NAME));
			this.message.addHeader(h);
		} catch (ParseException e) {
			logger.error("Error while setting content type header !!!", e);
		}

	}
407461
public void setType(String type) throws ApplicationException {
	if (StringUtil.isEmpty(type, true)) return;
	type = type.toLowerCase().trim();

	if (type.equals("url")) param.setType(HttpParamBean.TYPE_URL);
	else if (type.equals("formfield") || type.equals("form")) param.setType(HttpParamBean.TYPE_FORM);
	else if (type.equals("cgi")) param.setType(HttpParamBean.TYPE_CGI);
	else if (type.startsWith("head") || type.startsWith("header")) param.setType(HttpParamBean.TYPE_HEADER);
	else if (type.equals("cookie")) param.setType(HttpParamBean.TYPE_COOKIE);
	else if (type.equals("file")) param.setType(HttpParamBean.TYPE_FILE);
	else if (type.equals("xml")) param.setType(HttpParamBean.TYPE_XML);
	else if (type.equals("body")) param.setType(HttpParamBean.TYPE_BODY);
	else throw new ApplicationException("invalid type [" + type + "], valid types are [body,cgi,cookie,file,form,head,url,xml]");
    }
656389
function HttpViewResult(name, data)
{
    this.name = name;
    this.data = data===undefined? []: data;
    this.contentType = 'text/html;charset=utf-8';
    this.contentEncoding = 'utf8';
}
196748
public void setContent(Object content, String contentType)
			throws UnsupportedEncodingException {
		// https://code.google.com/p/sipservlets/issues/detail?id=202
		if(getSipSession().getProxy() == null) {
			checkMessageState();
		}
		checkContentType(contentType);
		checkCommitted();

		if(contentType != null && contentType.length() > 0) {
			this.addHeader(ContentTypeHeader.NAME, contentType);
			ContentTypeHeader contentTypeHeader = (ContentTypeHeader)this.message.getHeader(ContentTypeHeader.NAME);
			String charset = this.getCharacterEncoding();
			try {
			    // https://code.google.com/p/sipservlets/issues/detail?id=169
				if(contentType.contains(CONTENT_TYPE_MULTIPART) && content instanceof Multipart) {
					// Fix for Issue 2667 : Correct Handling of MimeMultipart
					Multipart multipart = (Multipart) content;
					OutputStream os = new ByteArrayOutputStream();
					multipart.writeTo(os);
					this.message.setContent(os.toString(), contentTypeHeader);
				} else {
					Object tmpContent = content;
					if(tmpContent instanceof String  && charset != null) {
						//test for unsupportedencoding exception
						new String("testEncoding".getBytes(charset));
						tmpContent = new String(((String)tmpContent).getBytes());
					}
					this.message.setContent(content, contentTypeHeader);
				}
			} catch (UnsupportedEncodingException uee) {
				throw uee;
			} catch (Exception e) {
				throw new IllegalArgumentException("Parse error reading content " + content + " with content type " + contentType, e);
			}
		}
	}
1187058
public static Object getRequestBody(PageContext pc, boolean deserialized, Object defaultValue) {

	HttpServletRequest req = pc.getHttpServletRequest();

	MimeType contentType = getContentType(pc);
	String strContentType = contentType == MimeType.ALL ? null : contentType.toString();
	Charset cs = getCharacterEncoding(pc, req);

	boolean isBinary = !(strContentType == null || HTTPUtil.isTextMimeType(contentType) || strContentType.toLowerCase().startsWith("application/x-www-form-urlencoded"));

	if (req.getContentLength() > -1) {
	    ServletInputStream is = null;
	    try {
		byte[] data = IOUtil.toBytes(is = req.getInputStream());// new byte[req.getContentLength()];
		Object obj = NULL;

		if (deserialized) {
		    int format = MimeType.toFormat(contentType, -1);
		    obj = toObject(pc, data, format, cs, obj);
		}
		if (obj == NULL) {
		    if (isBinary) obj = data;
		    else obj = toString(data, cs);
		}

		return obj;
	    }
	    catch (Exception e) {
		pc.getConfig().getLog("application").error("request", e);
		return defaultValue;
	    }
	    finally {
		IOUtil.closeEL(is);
	    }
	}

	return defaultValue;
    }
1275515
public View viewByContentType(String contentType) {
        for (View view: views.values()) {
            if (view.getContentType().equals(contentType)) {
                return view;
            }
        }
        return null;
    }
570809
public HttpRequest buildPostRequest(GenericUrl url, HttpContent content) throws IOException {
    return buildRequest(HttpMethods.POST, url, content);
  }
1346015
private static HttpEntity toHttpEntity(Object value, String mimetype, String charset) throws IOException {
	if (value instanceof HttpEntity) return (HttpEntity) value;

	// content type
	ContentType ct = HTTPEngine.toContentType(mimetype, charset);
	try {
	    if (value instanceof TemporaryStream) {
		if (ct != null) return new TemporaryStreamHttpEntity((TemporaryStream) value, ct);
		return new TemporaryStreamHttpEntity((TemporaryStream) value, null);
	    }
	    else if (value instanceof InputStream) {
		if (ct != null) return new ByteArrayEntity(IOUtil.toBytes((InputStream) value), ct);
		return new ByteArrayEntity(IOUtil.toBytes((InputStream) value));
	    }
	    else if (Decision.isCastableToBinary(value, false)) {
		if (ct != null) return new ByteArrayEntity(Caster.toBinary(value), ct);
		return new ByteArrayEntity(Caster.toBinary(value));
	    }
	    else {
		boolean wasNull = false;
		if (ct == null) {
		    wasNull = true;
		    ct = ContentType.APPLICATION_OCTET_STREAM;
		}
		String str = Caster.toString(value);
		if (str.equals("<empty>")) {
		    return new EmptyHttpEntity(ct);
		}
		if (wasNull && !StringUtil.isEmpty(charset, true)) return new StringEntity(str, charset.trim());
		else return new StringEntity(str, ct);
	    }
	}
	catch (Exception e) {
	    throw ExceptionUtil.toIOException(e);
	}
    }
291851
private void setContentTypeHeader(final HttpResponse response, final URLConnection connection) {
    response.headers().set(CONTENT_TYPE, mimeTypesMap.getContentType(connection.getURL().getPath()));
  }
438981
@Override
    public String getContentType() {
        if (url.getFile().endsWith("!/")) {
            // the type for jar file itself is always "x-java/jar"
            return "x-java/jar";
        }
        String cType = null;
        String entryName = getEntryName();

        if (entryName != null) {
            // if there is an Jar Entry, get the content type from the name
            cType = guessContentTypeFromName(entryName);
        } else {
            try {
                connect();
                cType = jarFileURLConnection.getContentType();
            } catch (IOException ioe) {
                // Ignore
            }
        }
        if (cType == null) {
            cType = "content/unknown";
        }
        return cType;
    }
1217012
@Override
    public String getContentType() {
        String type = this.response.getHeader("Content-Type");
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getContentType: " + type);
        }
        return type;
    }
553031
@Override
    public String getContentType() {
        try {
            collaborator.preInvoke(componentMetaData);
            return request.getContentType();
        } finally {
            collaborator.postInvoke();
        }
    }
878720
public ContentType getContentType() {
        String contentType = m_headers.get(HttpDefs.CONTENT_TYPE);
        if (contentType == null) {
            return null;
        }
        return new ContentType(contentType);
    }
103321
public void setContent(final byte[] content,
                         final String contentType) throws HttpException {
    if (!(method instanceof HttpEntityEnclosingRequestBase)) {
      throw new HttpException("Invalid operation for method " +
                               method.getMethod());
    }

    final HttpEntityEnclosingRequestBase eem = (HttpEntityEnclosingRequestBase)method;

    ByteArrayEntity entity = new ByteArrayEntity(content);
    entity.setContentType(contentType);
    eem.setEntity(entity);
  }
606453
public static Function<Service<HttpRequest, HttpResponse>,
            HttpEncodingService> contentEncodingDecorator(@Nullable String[] mimeTypes,
                                                          @Nullable String[] excludedUserAgents,
                                                          long minBytesToForceChunkedAndEncoding) {
        final Predicate<MediaType> encodableContentTypePredicate;
        if (mimeTypes == null || mimeTypes.length == 0) {
            encodableContentTypePredicate = contentType -> true;
        } else {
            final List<MediaType> encodableContentTypes =
                    Arrays.stream(mimeTypes).map(MediaType::parse).collect(toImmutableList());
            encodableContentTypePredicate = contentType ->
                    encodableContentTypes.stream().anyMatch(contentType::is);
        }

        final Predicate<HttpHeaders> encodableRequestHeadersPredicate;
        if (excludedUserAgents == null || excludedUserAgents.length == 0) {
            encodableRequestHeadersPredicate = headers -> true;
        } else {
            final List<Pattern> patterns =
                    Arrays.stream(excludedUserAgents).map(Pattern::compile).collect(toImmutableList());
            encodableRequestHeadersPredicate = headers -> {
                // No User-Agent header will be converted to an empty string.
                final String userAgent = headers.get(HttpHeaderNames.USER_AGENT, "");
                return patterns.stream().noneMatch(pattern -> pattern.matcher(userAgent).matches());
            };
        }

        return delegate -> new HttpEncodingService(delegate,
                                                   encodableContentTypePredicate,
                                                   encodableRequestHeadersPredicate,
                                                   minBytesToForceChunkedAndEncoding);
    }
995087
public String getBodyContentType() {
        if (networkRequest != null && networkRequest.contentType != null) {
            return networkRequest.contentType.toString();
        }
        return null;
    }