Retrieves the mime-type part of the content-type header. For instance on {@code Content-Type: text/html;
charset=ISO-8859-4}, it retrieves {@code text/html}.

@return the mime type of the content-type header
420750
public String contentMimeType() {
        String ct = contentType();
        if (ct != null) {
            int index = ct.indexOf(";");
            if (index != -1) {
                return ct.substring(0, index);
            } else {
                return ct;
            }
        } else {
            return null;
        }
    }
995087
public String getBodyContentType() {
        if (networkRequest != null && networkRequest.contentType != null) {
            return networkRequest.contentType.toString();
        }
        return null;
    }
194916
public static MessageProtocol fromContentTypeHeader(Optional<String> contentType) {
        return contentType.map(ct -> {
            String[] parts = ct.split(";");
            String justContentType = parts[0];
            Optional<String> charset = Optional.empty();
            for (int i = 1; i < parts.length; i++) {
                String toTest = parts[i].trim();
                if (toTest.startsWith("charset=")) {
                    charset = Optional.of(toTest.split("=", 2)[1]);
                    break;
                }
            }
            return new MessageProtocol(Optional.of(justContentType), charset, Optional.empty());
        }).orElse(new MessageProtocol());
    }
1050555
public function getMimeType()
    {
        if ($this->isUploaded() && $this->mime_type === null) {
            $temp_file_name = $this->getTempFileName();
            if (file_exists($temp_file_name)) {
                if (extension_loaded('fileinfo')) {
                    // Use the fileinfo extension if available.
                    $finfo = $this->getFinfo();
                    $this->mime_type = explode(
                        ';',
                        $finfo->file($temp_file_name)
                    )[0];
                } elseif (function_exists('mime_content_type')) {
                    // Fall back to mime_content_type() if available.
                    $this->mime_type = mime_content_type($temp_file_name);
                }

                // No mime-detection functions, or mime-detection function
                // failed to detect the type. Default to
                // 'application/octet-stream'. Relying on HTTP headers could
                // be a security problem so we never fall back to that option.
                if ($this->mime_type == '') {
                    $this->mime_type = 'application/octet-stream';
                }
            } else {
                $this->mime_type = $this->file['type'];
            }
        }

        return $this->mime_type;
    }
516718
def get_content_type(name, content):
    
    if hasattr(content, "content_type"):
        content_type = content.content_type
    else:
        mime_type, encoding = mimetypes.guess_type(name)
        content_type = mime_type
    return content_type
999206
public static String getCharsetFromContentType(String type) {
    	init();
        if (type == null) {
            return null;
        }

        int semi = type.indexOf(";");

        if (semi == -1) {
            return null;
        }

        String afterSemi = type.substring(semi + 1);

        int charsetLocation = afterSemi.indexOf("charset=");

        if (charsetLocation == -1) {
            return null;
        }

        return afterSemi.substring(charsetLocation + 8).trim();
    }
1206592
def mimetype(self):
        """"""
        ct = self.headers.get("content-type")
        if ct:
            return ct.split(";")[0].strip()
925508
public function getCharset()
    {
        $charset = $this->getHeaderParameter('Content-Type', 'charset');
        if ($charset === null) {
            $contentType = $this->getContentType();
            if ($contentType === 'text/plain' || $contentType === 'text/html') {
                return 'ISO-8859-1';
            }
            return null;
        }
        return trim(strtoupper($charset));
    }
294982
public static String getMimeType(String url) {
        String extension = getExtension(url);
        if (!MimeTypeMap.getSingleton().hasExtension(extension)) return "";

        String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
        return TextUtils.isEmpty(mimeType) ? "" : mimeType;
    }
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;
    }
414913
protected String getContentType(Resource resource, @SuppressWarnings("unused") SlingHttpServletRequest request) {
    String mimeType = JcrBinary.getMimeType(resource);
    if (StringUtils.isEmpty(mimeType)) {
      mimeType = ContentType.OCTET_STREAM;
    }
    return mimeType;
  }
484501
public function getContentType()
    {
        if (empty($this->_content_type) && $this->_headers->has('Content-Type'))
        {
            $type = $this->_headers->get('Content-Type');

            //Strip parameters from content-type like "; charset=UTF-8"
            if (is_string($type))
            {
                if (preg_match('/^([^,\;]*)/', $type, $matches)) {
                    $type = $matches[1];
                }
            }

            $this->_content_type = $type;
        }

        return $this->_content_type;
    }
213910
public com.google.api.ads.admanager.axis.v201805.MimeType getMimeType() {
        return mimeType;
    }
878720
public ContentType getContentType() {
        String contentType = m_headers.get(HttpDefs.CONTENT_TYPE);
        if (contentType == null) {
            return null;
        }
        return new ContentType(contentType);
    }
797320
private static String getResponseMimeType(final HttpResponse httpHeadResponse) {
        Header contentTypeHeader = httpHeadResponse.getFirstHeader("Content-Type");
        if (contentTypeHeader != null) {
            String contentType = contentTypeHeader.getValue();
            if (contentType != null) {
                try {
                    return ContentType.parse(contentType).getMimeType();
                } catch (ParseException | UnsupportedCharsetException exception) {
                    return contentType.split(";")[0].trim();
                }
            }
        }

        return ContentType.DEFAULT_TEXT.getMimeType();
    }
58611
public String getType() {
        Object type = getHeader(JmsMessageHeaders.TYPE);

        if (type != null) {
            return type.toString();
        }

        return null;
    }
478913
public String getMimeType() {
		if (format != null) {
			if (format == Format.JPEG && progressive)
			{
				return "image/pjpeg";
			}
			return format.getMimeType();
		} else {
			return null;
		}
	}