@param string $contentType
@param ContentHandlerInterface $handler

@return void
557260
public function registerHandler($contentType, ContentHandlerInterface $handler)
    {
        if (!is_string($contentType)) {
            throw new Exception('Invalid content handler specified.');
        }

        $this->handlers[$contentType] = $handler;
    }
613932
public void process(ContentHandler handler) {
    try {
      if (logger.isInfoEnabled())
        logger.info("Processing input source with SAX content handler");

      XMLReader reader = makeReader(false);

      reader.setContentHandler(handler);

      reader.parse(content);
    } catch (SAXException e) {
      logger.error("Failed to process input source with SAX content handler",e);
      throw new MarkLogicInternalException(e);
    } catch (IOException e) {
      logger.error("Failed to process input source with SAX content handler",e);
      throw new MarkLogicInternalException(e);
    }
  }
171231
public function addToContentType($fieldName, ContentType $contentType)
    {
        try {
            $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentType->id);
        } catch (NotFoundException $e) {
            $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($contentType);
        }

        $typeUpdate = $this->contentTypeService->newContentTypeUpdateStruct();
        $typeUpdate->modificationDate = new DateTime();

        $knowLanguage = array_keys($contentType->getDescriptions());

        if (!in_array($contentType->mainLanguageCode, $knowLanguage)) {
            $knowLanguage[] = $contentType->mainLanguageCode;
        }

        $fieldCreateStruct = $this->contentTypeService->newFieldDefinitionCreateStruct(
            $fieldName,
            'novaseometas'
        );

        $fieldCreateStruct->names = array_fill_keys($knowLanguage, $this->metaFieldName);
        $fieldCreateStruct->descriptions = array_fill_keys($knowLanguage, $this->metaFieldDescription);
        $fieldCreateStruct->fieldGroup = $this->metaFieldGroup;
        $fieldCreateStruct->position = 100;
        $fieldCreateStruct->isTranslatable = true;
        $fieldCreateStruct->isRequired = false;
        $fieldCreateStruct->isSearchable = false;
        $fieldCreateStruct->isInfoCollector = false;

        try {
            $this->contentTypeService->updateContentTypeDraft($contentTypeDraft, $typeUpdate);

            if ($contentTypeDraft->getFieldDefinition($fieldName) == null) {
                $this->contentTypeService->addFieldDefinition($contentTypeDraft, $fieldCreateStruct);
            }

            $this->contentTypeService->publishContentTypeDraft($contentTypeDraft);

            return true;
        } catch (Exception $e) {
            $this->errorMessage = $e->getMessage();

            return false;
        }
    }
791131
public function addFatalErrorHandler($handler) {
        if ( ! $handler instanceof INativeErrorHandler && ! is_callable($handler)) {
            throw new InvalidHandlerType(
                s('Fatal error handler must be a callable or an instance of %s.',
                    INativeErrorHandler::class)
            );
        }

        if (is_callable($handler)) {
            $handler = $this->createNativeErrorHandler($handler);
        }

        $this->fatalErrorHandlers[] = $handler;
    }
259989
public void setContentHandler(ContentHandler handler)
  {

    if (handler == null)
    {
      throw new NullPointerException(XSLMessages.createMessage(XSLTErrorResources.ER_NULL_CONTENT_HANDLER, null)); //"Null content handler");
    }
    else
    {
      m_outputContentHandler = handler;

      if (null == m_serializationHandler)
      {
        ToXMLSAXHandler h = new ToXMLSAXHandler();
        h.setContentHandler(handler);
        h.setTransformer(this);
        
        m_serializationHandler = h;
      }
      else
        m_serializationHandler.setContentHandler(handler);
    }
  }
612216
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        RendererFacade::init($this->renderer);
        return $handler->handle($request);
    }
71889
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $this->migration_service
            ->updateSchema('\Fisharebest\Webtrees\Schema', 'WT_SCHEMA_VERSION', Webtrees::SCHEMA_VERSION);

        return $handler->handle($request);
    }
653602
public function setContentType(ContentType $contentType)
    {
        $this->contentTypeName = $contentType->getName();
        $this->contentTypeId = null;

        return parent::setContentType($contentType);
    }
389512
private void setContentType(String contentType) {
        // The content type may contain the charset, parse it and set it.
        if (contentType != null && contentType.contains("charset=")) {
            charset = Charset.forName(contentType.substring(contentType.indexOf("charset=") + 8).trim());
        }
        headers.put(HeaderNames.CONTENT_TYPE, contentType);
    }
34131
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $response = $this->negotiator->process($request, $handler);

        if (! $response instanceof UnformattedResponse) {
            return $response;
        }

        $contentType = $this->extractContentType($response->getHeaderLine('Content-Type'));
        $formatter   = $this->formatters[$contentType] ?? null;

        return $this->formatResponse($response, $formatter);
    }
1064048
protected function PrintOut($text,$contentType = null)
	{
		if ($this->CaptureOutputMode)
		{
			$this->DebugOutput .= $text;
		}
		else
		{
			if ($contentType) header("Content-type: " . $contentType);
			print $text;
		}
	}
685440
public function setContentType(string $contentType, string $contentCharset = null): self
    {
        $this->contentType = $contentType;

        if ($contentCharset !== null) {
            $this->setContentCharset($contentCharset);
        }

        return $this;
    }
353833
public function processFieldsChangeType(ContentTypeInterface $contentType, $fieldTypes)
    {
        foreach ($contentType->getFields() as $field) {
            if (!isset($fieldTypes[$field->getId()])) {
                continue;
            }
            if ($fieldTypes[$field->getId()] == $field->getType()) {
                continue;
            }

            $this->om->remove($field);

            $fieldClass = $this->configurationManager->getEntityClass('field');
            $newField = new $fieldClass;
            $newField->setType($field->getType());
            $newField->setContentType($field->getContentType());
            $newField->setName($field->getName());
            $newField->setSlug($field->getSlug());
            $newField->setRequired($field->isRequired());
            $newField->setSortOrder($field->getSortOrder());
            $newField->setOptions($field->getOptions());
            $newField->setHint($field->getHint());
            $this->om->persist($newField);
        }
    }
261892
public function detach($eventType, $handler)
    {
        if (!isset($this->listeners[$eventType])) {
            return;
        }

        if (is_object($this->listeners[$eventType])) {
            // @attention PriorityQueue不支持移除
            $newPriorityQueue = new PriorityQueue();
            $newPriorityQueue->setExtractFlags(PriorityQueue::EXTR_DATA);

            /** @var PriorityQueue $oldPriorityQueue */
            $oldPriorityQueue = &$this->listeners[$eventType];
            $oldPriorityQueue->setExtractFlags(PriorityQueue::EXTR_BOTH);
            $oldPriorityQueue->top();

            foreach ($oldPriorityQueue as $currHandler) {
                if ($currHandler['data'] !== $handler) {
                    $newPriorityQueue->insert($currHandler['data'], $currHandler['priority']);
                }
            }

            $this->listeners[$eventType] = $newPriorityQueue;
        } else {
            if (($idx = array_search($handler, $this->listeners[$eventType], true)) !== false) {
                unset($this->listeners[$eventType][$idx]);
            }
        }
    }
122811
public function transform($contentType, array $params = array())
    {
        if (!$contentType instanceof ContentTypeInterface) {
            throw new TransformerParameterTypeException();
        }

        $facade = $this->newFacade();

        $facade->id = $contentType->getId();
        $facade->contentTypeId = $contentType->getContentTypeId();
        $facade->name = $this->multiLanguagesChoiceManager->choose($contentType->getNames());
        $facade->version = $contentType->getVersion();
        $facade->linkedToSite = $contentType->isLinkedToSite();
        $facade->definingVersionable = $contentType->isDefiningVersionable();
        $facade->definingStatusable = $contentType->isDefiningStatusable();
        $facade->defaultListable = $contentType->getDefaultListable();

        if ($this->hasGroup(CMSGroupContext::AUTHORIZATIONS)) {

            $facade->addRight('can_delete', $this->authorizationChecker->isGranted(ContributionActionInterface::DELETE, $contentType) &&
                $this->businessRulesManager->isGranted(BusinessActionInterface::DELETE, $contentType));

            $facade->addRight('can_duplicate', $this->authorizationChecker->isGranted(ContributionActionInterface::CREATE, ContentTypeInterface::ENTITY_TYPE));

            $facade->addRight(
                'can_create',
                $this->authorizationChecker->isGranted(ContributionActionInterface::CREATE, ContentTypeInterface::ENTITY_TYPE)
            );

            $content = $this->contentManager->initializeNewContent(
                $contentType->getContentTypeId(),
                '',
                $contentType->isLinkedToSite() && $contentType->isAlwaysShared(),
                $contentType->isDefiningStatusable()
            );
            $facade->addRight(
                'can_create_content',
                $this->authorizationChecker->isGranted(ContributionActionInterface::CREATE, $content)
            );

        }

        if ($this->hasGroup(CMSGroupContext::FIELD_TYPES)) {
            foreach ($contentType->getFields() as $field) {
                $facade->addField($this->getContext()->transform('field_type', $field));
            }
        }

        return $facade;
    }
1029637
protected function getFromListeners($contentType, $response)
    {

        foreach (['before', 'after'] as $position) {
            foreach ($this->getAfterOrBeforeListeners('handle',
                $position) as $listener) {
                if($result = $listener($contentType, $response, $this)) {
                    return $result;
                }


            }
        }

        return null;
    }
1133950
public function setContentType(string $content_type)
    {
        if (empty($content_type)) {
            Throw new HeaderException('Empty content type is not allowed.');
        }

        $this->content_type = $content_type;
    }