Retrieves and validates the content type from the REST requests

@return true if has content type.
519814
protected boolean hasContentType() {

        boolean result = false;
        if(this.request.getHeader(RestMessageHeaders.CONTENT_TYPE) != null) {
            result = true;
        } else {
            logger.error("Error when validating put request. Missing Content-Type header.");
            RestErrorHandler.writeErrorResponse(this.messageEvent,
                                                HttpResponseStatus.BAD_REQUEST,
                                                "Missing Content-Type header");
        }
        return result;
    }
715898
private ContentType getAcceptType() {
        // If the format header is present, it overrides the ACCEPT header.
        String format = m_variableMap.get("format");
        if (format != null) {
            return new ContentType(format);
        }
        String acceptParts = m_request.getHeader(HttpDefs.ACCEPT);
        if (!Utils.isEmpty(acceptParts)) {
	        for (String acceptPart : acceptParts.split(",")) {
	            ContentType acceptType = new ContentType(acceptPart);
	            if (acceptType.isJSON() || acceptType.isXML() || acceptType.isPlainText()) {
	                return acceptType;
	            }
	        }
        }
        return getContentType();
    }
5954
@Trivial
    @Override
    public String getContentType() {
        String type = this.request.getHeader("Content-Type");
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getContentType: " + type);
        }
        return type;
    }
92025
@Override
	public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) {
		if (!Constants.PARAM_HISTORY.equals(theRequest.getOperation())) {
			return false;
		}
		if (theRequest.getResourceName() == null) {
			return myResourceOperationType == RestOperationTypeEnum.HISTORY_SYSTEM;
		}
		if (!StringUtils.equals(theRequest.getResourceName(), myResourceName)) {
			return false;
		}

		boolean haveIdParam = theRequest.getId() != null && !theRequest.getId().isEmpty();
		boolean wantIdParam = myIdParamIndex != null;
		if (haveIdParam != wantIdParam) {
			return false;
		}

		if (theRequest.getId() == null) {
			return myResourceOperationType == RestOperationTypeEnum.HISTORY_TYPE;
		} else if (theRequest.getId().hasVersionIdPart()) {
			return false;
		}

		return true;
	}
1151435
public boolean includesDefinedInContent() {

        if ((m_types == null) || m_types.isEmpty()) {
            return true;
        }
        Iterator<CmsRelationType> itTypes = m_types.iterator();
        while (itTypes.hasNext()) {
            CmsRelationType type = itTypes.next();
            if (type.isDefinedInContent()) {
                return true;
            }
        }
        return false;
    }
725789
public boolean hasNext()
	{

		try {
			switch (modus) {
			case INIT:
				return queryArticle();

			case ITERATE_WITH_MAPPING:
				if (chronoIterator.hasNext()) {
					return true;
				}

				reset();

				if (resultArticles.next()) {

					this.currentArticleID = resultArticles.getInt(1);
					return (this.lastArticleID == -1)
							|| (this.currentArticleID <= this.lastArticleID);
				}

				resultArticles.close();
				return queryArticle();

			case ITERATE_WITHOUT_MAPPING:

				if (revisionIterator.hasNext()) {
					return true;
				}

				reset();

				if (resultArticles.next()) {

					this.currentArticleID = resultArticles.getInt(1);
					return (this.lastArticleID == -1)
							|| (this.currentArticleID <= this.lastArticleID);
				}

				resultArticles.close();
				return queryArticle();

			default:
				throw new RuntimeException("Illegal mode");
			}

		}
		catch (SQLException e) {
			throw new RuntimeException(e);
		}
	}
253825
public boolean isBye() {
    if (message == null) {
      return false;
    }

    return (((Request) message).getMethod().equals(Request.BYE));
  }
1005630
static String getCharsetFromContentType(String contentType) {
        if (contentType == null) return null;
        Matcher m = charsetPattern.matcher(contentType);
        if (m.find()) {
            String charset = m.group(1).trim();
            charset = charset.replace("charset=", "");
            return validateCharset(charset);
        }
        return null;
    }
1190324
public static boolean isMultiPartForm(@CheckForNull String contentType) {
        if (contentType == null) {
            return false;
        }

        String[] parts = contentType.split(";");
        return ArrayUtils.contains(parts, "multipart/form-data");
    }
433041
public void checkContentType(final HttpServletRequest request) {
    String reqpar = request.getParameter(getContentTypeRequestName());

    if (reqpar != null) {
      if (reqpar.equals("!")) {
        // Go back to unsticky content type
        setContentTypeSticky(false);
      } else {
        setContentType(reqpar);
        setContentTypeSticky(false);
      }
    }

    reqpar = request.getParameter(getContentTypeStickyRequestName());
    if (reqpar != null) {
      if (reqpar.equals("!")) {
        // Go back to unsticky content type
        setContentTypeSticky(false);
      } else {
        setContentType(reqpar);
        setContentTypeSticky(true);
      }
    }
  }
995087
public String getBodyContentType() {
        if (networkRequest != null && networkRequest.contentType != null) {
            return networkRequest.contentType.toString();
        }
        return null;
    }
662389
public function isJson()
    {
        $value = $this->getHeader('Content-Type');
        if ($value === null) {
            return false;
        }

        return !empty(preg_grep('|application/json|i', $value));
    }
1268218
protected Set<String> getContentTypes(String contentType) {
        if (StringUtils.isNullOrEmpty(contentType)) {
            return Collections.emptySet();
        }

        Set<String> set = new LinkedHashSet<>();
        String[] types = contentType.split(",");
        for (String type : types) {
            if (type.contains(";")) {
                // drop ;q=0.8 quality scores
                type = type.substring(0, type.indexOf(';'));
            }

            set.add(type.trim().toLowerCase());
        }

        return set;
    }
1032233
public boolean mediaIsGIF () {
        String contentType = this.getContentType();
        return contentType != null && this.media != null && contentType.equals("image/gif");
    }
1058852
public static boolean isHttpGetRequest(HttpServletRequest request) {
        boolean isSane = isSaneRequest(request);
        boolean isGet = isSane && request.getMethod().equals(HttpMethod.GET.toString());
        return isSane && isGet;
    }
668164
def invalid_content_type(self, request=None, response=None):
        """"""
        if callable(self.invalid_outputs.content_type):
            return self.invalid_outputs.content_type(request=request, response=response)
        else:
            return self.invalid_outputs.content_type
801869
public static function getContentType() {
    if(null === self::$contentType) {
      self::$contentType = @trim($_SERVER['HTTP_CONTENT_TYPE']);
      if(!self::$contentType) {
        self::$contentType = @trim($_SERVER['CONTENT_TYPE']);
        if(!self::$contentType) {
          self::$contentType = false;
        }
      }
    }
    return self::$contentType;
  }