Returns an acceptable plain text media type if possible, or null if not.
@return an acceptable plain-text media type, or null
497134
private MediaType acceptabePlainTextMediaType() {
        final List<MediaType> acceptable = headers.getAcceptableMediaTypes();
        if (acceptable == null || acceptable.size() == 0) {
            return TEXT_PLAIN_TYPE;
        }
        for (final MediaType type : acceptable) {
            if (type.isWildcardType() || (type.isCompatible(TEXT_PLAIN_TYPE) && type.isWildcardSubtype())) {
                return TEXT_PLAIN_TYPE;
            } else if (type.isCompatible(TEXT_PLAIN_TYPE)) {
                return type;
            }
        }
        return null;
    }
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;
    }
416614
protected @Nullable HtmlElement<?> getMediaElement(@NotNull Media media) {
    PictureSource[] pictureSources = media.getMediaRequest().getMediaArgs().getPictureSources();
    if (pictureSources != null && pictureSources.length > 0) {
      return getPictureElement(media);
    }
    else {
      return getImageElement(media);
    }
  }
1228112
public String getContentType() {
		ContentTypeHeader cth = (ContentTypeHeader) this.message
				.getHeader(getCorrectHeaderName(ContentTypeHeader.NAME));
		if (cth != null) {
			// Fix For Issue http://code.google.com/p/mobicents/issues/detail?id=2659
			// getContentType doesn't return the full header value
//			String contentType = cth.getContentType();
//			String contentSubType = cth.getContentSubType();
//			if(contentSubType != null)
//				return contentType + "/" + contentSubType;
			return ((HeaderExt)cth).getValue();
		}
		return null;
	}
931688
@Override
   public String getContentType()
   {
      try
      {
         if (!connected)
         {
            connect();
         }

         return nodeRepresentation.getMediaType();
      }
      catch (IOException e)
      {
         if (LOG.isTraceEnabled())
         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }
      catch (RepositoryException e)
      {
         if (LOG.isTraceEnabled())
         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }
      return null;
   }
636821
@Trivial
    public static String typeToString(MediaType type, List<String> ignoreParams) {
        if (type == null) {
            throw new IllegalArgumentException("MediaType parameter is null");
        }
        StringBuilder sb = new StringBuilder();
        sb.append(type.getType()).append('/').append(type.getSubtype());

        Map<String, String> params = type.getParameters();
        if (params != null) {
            for (Iterator<Map.Entry<String, String>> iter = params.entrySet().iterator();
                iter.hasNext();) {
                Map.Entry<String, String> entry = iter.next();
                if (ignoreParams != null && ignoreParams.contains(entry.getKey())) {
                    continue;
                }
                sb.append(';').append(entry.getKey()).append('=').append(entry.getValue());
            }
        }

        return sb.toString();
    }
1032233
public boolean mediaIsGIF () {
        String contentType = this.getContentType();
        return contentType != null && this.media != null && contentType.equals("image/gif");
    }
1134109
@Override
    public Set<String> getSupportedInputMediaTypes() {
        ImmutableSet.Builder<String> result = ImmutableSet.builder();
        result.addAll(MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.keySet());
        result.addAll(this.serviceTransformationEngine.getSupportedMediaTypes());
        return result.build();
    }
946697
public List<ContentCodingType> getContentEncoding() {
		String value = getFirst(CONTENT_ENCODING);
		return (value != null ? ContentCodingType.parseCodingTypes(value) : Collections.<ContentCodingType>emptyList());
	}
219039
public String getContentType() {
        String[] values = getMimeHeader("Content-Type");
        if (values != null && values.length > 0)
            return values[0];
        return null;
    }
791906
public static String getDefaultMediaType(ResultType expectedType) {
    ResponseFormat format = (expectedType != null) ? defaultTypeFormats.get(expectedType) : null;
    
    // If the expected type is unknown, we should let the server decide, otherwise we could
    // wind up requesting a response type that doesn't match the actual resuts (e.g. xml with CONSTRUCT).
    // TODO: We could include multiple media types in the Accept: field, but that assumes that the
    // server has proper support for content negotiation. Many servers only look at the first value.
    return (format != null) ? format.mimeText : null;
  }
58611
public String getType() {
        Object type = getHeader(JmsMessageHeaders.TYPE);

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

        return null;
    }
659390
private static String getMessage(Media media)
    {
        Check.notNull(media);

        return new StringBuilder(Constant.BYTE_4).append('[').append(media.getPath()).append("] ").toString();
    }
1169493
@Nullable
    public final EnhancedMimeType getMetaContentType() {
        if ((metaContentType == null) && (metaContentTypeStr != null)) {
            metaContentType = EnhancedMimeType.create(metaContentTypeStr);
        }
        return metaContentType;
    }
439484
public String getResourceType() {
        if (resourceType == null) {
            resourceType = "";
            String type = resource.getResourceType();
            if (StringUtils.isBlank(type) || getPrimaryType().equals(type)) {
                Resource contentResource = getContentResource();
                if (contentResource != null) {
                    type = contentResource.getResourceType();
                    if (StringUtils.isNotBlank(type)) {
                        ResourceHandle handle = ResourceHandle.use(contentResource);
                        if (type.equals(handle.getPrimaryType())) {
                            type = null;
                        }
                    }
                }
            }
            if (StringUtils.isNotBlank(type)) {
                // check for a real existing resource type
                if (!Resource.RESOURCE_TYPE_NON_EXISTING.equals(type)) {
                    resourceType = type;
                }
            }
        }
        return resourceType;
    }
102278
public boolean mediaIsImage() {
        String contentType = this.getContentType();
        return contentType != null && this.media != null && contentType.startsWith("image") && !contentType.equals("image/gif");
    }
274786
@Override
	public String getMimeType() {
		String contentType = backing.getContentType();

		// IE6 (and apparently IE7) are broken and send the MIME type "image/pjpeg"
		// regardless of whether the image is a progressive jpeg or not. Sending the
		// incorrect MIME type back can cause display issues. It is always safe to
		// change it to just be "image/jpeg".
		if ("image/pjpeg".equals(contentType)) {
			contentType = "image/jpeg";
		}

		return contentType;
	}