Sets content type.
767841
public void setContentType(String contentType) throws InvalidArgumentException {
    if (Strings.isNullOrEmpty(contentType)) {
      throw new InvalidArgumentException("empty content type");
    }

    this.contentType = contentType;
  }
627449
private void setNegotiatedContentType() {
        ConnegHandler.NegotiatedMediaType negotiatedMediaType = exchange.getAttachment(ConnegHandler.NEGOTIATED_MEDIA_TYPE);
        MediaType negotiated = negotiatedMediaType == null ? responseContentType : negotiatedMediaType.produces;
        setResponseMediaType(negotiated);
    }
801344
def set_input_format(self, content_type, handler):
        """"""
        if getattr(self, '_input_format', None) is None:
            self._input_format = {}
        self._input_format[content_type] = handler
1280081
public void setContent(final String content) {
        if (content != null)
            attrMixin.setAttribute(CONTENT, content);
        else
            attrMixin.removeAttribute(CONTENT);
    }
42727
public function setContent($content)
    {
        $this->content = null;
        if ($content === null) {
            return;
        }

        if (TypeHandling::isSimpleType(gettype($content)) && !is_array($content)) {
            $this->content = (string)$content;
        }

        if (is_resource($content)) {
            $this->content = $content;
        }

        return $this;
    }
1237223
public void setDefaultContentType(DefaultContentType value) {
        defaultContentType = value;
        if (defaultContentType != null) {
            setData("");
            searchable = false;
            orderable = false;
        }
    }
1200028
public final void setContent(byte[] content)
    {
        //clear non relevant flags
        this.contentString=null;
        this.contentParts=null;
        this.contentType=ContentType.BINARY;

        if(content==null)
        {
            this.contentBinary=null;
        }
        else
        {
            this.contentBinary=content.clone();
        }
    }
878217
public function setContentType($contentType = null)
    {
        if ($contentType === null) {
            $contentType = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : null;
        }

        $this->contentType = $contentType;
    }
244484
public function setContent(Content $content)
    {
        $this->contentTypeName = $content->getType()->getName();
        $this->contentId = $content->getContentId();

        return parent::setContent($content);
    }
102142
public Response andContentType(String contentType) {
        Objects.requireNonNull(contentType, Required.CONTENT_TYPE.toString());
        this.contentType = contentType;
        this.headers.put(Header.CONTENT_TYPE.toHttpString(), contentType);

        return this;
    }
352888
public function setContentType($type, $statusCode=null)
    {
        if (isset(static::$_types[$type])) {
            $type = static::$_types[$type];
        }
        $this->setHeader('Content-Type', $type);
        if ($statusCode) {
            $this->_statusCode = $statusCode;
        }
    }
623901
public void setContentType(int pathId, String contentType) {
        PreparedStatement statement = null;
        try (Connection sqlConnection = sqlService.getConnection()) {
            statement = sqlConnection.prepareStatement(
                "UPDATE " + Constants.DB_TABLE_PATH +
                    " SET " + Constants.PATH_PROFILE_CONTENT_TYPE + " = ? " +
                    " WHERE " + Constants.GENERIC_ID + " = ?"
            );
            statement.setString(1, contentType);
            statement.setInt(2, pathId);
            statement.executeUpdate();
            statement.close();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
    }
846842
def smart_content_type(self):
        """"""
        content_type = self.content_type
        if content_type in (None, '', 'application/octet-stream'):
            content_type, _ = mimetypes.guess_type(self.name)

        return content_type
990345
public function setContentType($content_type, $charset = null)
    {
        $this->params['content-type'] = $content_type;
        if ($charset !== null) {
            $this->setCharset($charset);
        }

        return $this;
    }
568757
public function setContent($content)
    {
        if (is_array($content)) {
            $this->setContentType('json');
            $this->_content = json_encode($content, JSON_PRETTY_PRINT);
        } else {
            $this->_content = (string) $content;
        }
    }
488051
public function setContentTypeHeader(string $header)
    {
        if (Validation::isValidContentType($header)) {
            $this->contentTypeHeader = $header;
        } else {
            throw new CustomException('Invalid content type');
        }
    }
1070213
public function setContentType($contentType) {
    $this->contentType = $contentType;
    
    $ct = $this->contentType;
    if (isset($this->charset))
      $ct .= '; charset='.$this->charset;

    $this->setMeta('content-type',$ct, TRUE);
  }