Get the content-type, including the optional ";base64".
183622
public String getFullContentType() {
        final String url = this.url.toExternalForm().substring("data:".length());
        final int endIndex = url.indexOf(',');
        if (endIndex >= 0) {
            final String contentType = url.substring(0, endIndex);
            if (!contentType.isEmpty()) {
                return contentType;
            }
        }
        return "text/plain;charset=US-ASCII";
    }
619090
def base64(self, extras=()):
        
        s = self._marshal_json(extras=extras)
        s_bytes = s if isinstance(s, bytes) else s.encode('utf-8')
        b64enc = base64.b64encode(s_bytes)
        return b64enc.decode('utf-8') if isinstance(b64enc, bytes) else b64enc
240996
def _needs_base64_encoding(self, attr_type, attr_value):
        
        return attr_type.lower() in self._base64_attrs or \
            isinstance(attr_value, bytes) or \
            UNSAFE_STRING_RE.search(attr_value) is not None
942205
def content_type(self) -> Optional[ContentTypeHeader]:
        """"""
        try:
            return cast(ContentTypeHeader, self[b'content-type'][0])
        except (KeyError, IndexError):
            return None
940933
def encoded_content(self, path):
        """"""
        if path in self.__class__.asset_contents:
            return self.__class__.asset_contents[path]
        data = self.read_bytes(path)
        self.__class__.asset_contents[path] = force_text(base64.b64encode(data))
        return self.__class__.asset_contents[path]
482473
def _get_content_type(url):
        """"""
        scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
        if not scheme in ('http', 'https', 'ftp', 'ftps'):
            ## FIXME: some warning or something?
            ## assertion error?
            return ''
        req = Urllib2HeadRequest(url, headers={'Host': netloc})
        resp = urlopen(req)
        try:
            if hasattr(resp, 'code') and resp.code != 200 and scheme not in ('ftp', 'ftps'):
                ## FIXME: doesn't handle redirects
                return ''
            return resp.info().get('content-type', '')
        finally:
            resp.close()
219039
public String getContentType() {
        String[] values = getMimeHeader("Content-Type");
        if (values != null && values.length > 0)
            return values[0];
        return null;
    }
746041
public static String encode(String content) {
		if (content == null || content.length() == 0) {
			return content;
		}
		return org.apache.commons.codec.binary.Base64.encodeBase64String(content.getBytes()).trim();

	}
846740
def bytes_base64(x):
    """"""
    if six.PY2:
        return base64.encodestring(x).replace('\n', '')
    return base64.encodebytes(bytes_encode(x)).replace(b'\n', b'')
860501
private String getEncoding(final String contentType) {
        if (contentType == null || !contentType.contains(CHARSET)) {
            return DEFAULT_ENCODING;
        }
        String encoding = null;
        try {
            encoding = contentType.substring(contentType.indexOf(CHARSET) + CHARSET.length());
            encoding = encoding.toLowerCase().replaceAll("\"", "");
        } catch (Exception e) {
            //Extraction from the string failed.
        }
        if (!validEncodings.contains(encoding)) {
            LOGGER.warn("Invalid Encoding '{}' - using default - '{}'", encoding, DEFAULT_ENCODING);
            encoding = DEFAULT_ENCODING;
        }
        return encoding;
    }
1247231
def _guess_content_type(url):
    '''
    
    '''
    OCTET_STREAM = 'application/octet-stream'
    n = url.rfind('.')
    if n == -1:
        return OCTET_STREAM
    return mimetypes.types_map.get(url[n:].lower(), OCTET_STREAM)
968604
public String getNormalisedContentTypeValue() {
        String contentType = getHeader(CONTENT_TYPE);
        if (contentType != null) {
            return contentType.toLowerCase(Locale.ROOT);
        }
        return null;
    }
375443
def content_type(self) -> ContentType:
        """"""
        if self._ctype:
            return self._ctype
        return (ContentType.config if self.parent.config else
                ContentType.nonconfig)
620297
@Override
	protected String getContentType(String filePath, HttpServletRequest request) {
		String requestUri = request.getRequestURI();

		// Retrieve the extension
		String extension = getExtension(filePath);
		if (extension == null) {

			LOGGER.info("No extension found for the request URI : " + requestUri);
			return null;
		}

		String binContentType = (String) binaryMimeTypeMap.get(extension);
		if (binContentType == null) {

			LOGGER.info(
					"No binary extension match the extension '" + extension + "' for the request URI : " + requestUri);
			return null;
		}
		return binContentType;
	}
757880
public String getContentType() {
        final Object contentType = getHeader(HttpMessageHeaders.HTTP_CONTENT_TYPE);

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

        return null;
    }
612237
private String guessMimeTypeFromContents(final ChannelBuffer buf) {
    if (!buf.readable()) {
      logWarn("Sending an empty result?! buf=" + buf);
      return "text/plain";
    }
    final int firstbyte = buf.getUnsignedByte(buf.readerIndex());
    switch (firstbyte) {
      case '<':  // <html or <!DOCTYPE
        return HTML_CONTENT_TYPE;
      case '{':  // JSON object
      case '[':  // JSON array
        return "application/json";  // RFC 4627 section 6 mandates this.
      case 0x89:  // magic number in PNG files.
        return "image/png";
    }
    return "text/plain";  // Default.
  }
324700
public String getContentType() {
        String contentType = getHeader(HttpConstants.Header.CONTENT_TYPE);
        if (contentType == null) {
            contentType = httpServletResponse.getContentType();
        }

        return contentType;
    }