public interface ContentValidator
Modifier and Type | Method and Description |
---|---|
String |
determineContentType(boolean strictContentTypeValidation,
org.sonatype.nexus.common.io.InputStreamSupplier contentSupplier,
org.sonatype.nexus.mime.MimeRulesSource mimeRulesSource,
String contentName,
String declaredContentType)
Determines or confirms the content type for the given content, or throws
InvalidContentException if it
cannot. |
@Nonnull String determineContentType(boolean strictContentTypeValidation, org.sonatype.nexus.common.io.InputStreamSupplier contentSupplier, @Nullable org.sonatype.nexus.mime.MimeRulesSource mimeRulesSource, @Nullable String contentName, @Nullable String declaredContentType) throws IOException
InvalidContentException
if it
cannot.strictContentTypeValidation
- whether the check should be strict or not.contentSupplier
- the supplier of the content to determine or confirm content type.contentName
- blob name, usually a file path or file name or just extension
(file extension is used to determine content type along with "magic" detection
where actual content bits are used, like file headers or magic bytes). Is
optional, but be aware that if present it improves content type detection
reliability.mimeRulesSource
- if non-null, mime rules source to use.declaredContentType
- if non-null, the declared content type will be confirmed, if null, this method
will attempt to determine the content type.org.sonatype.nexus.repository.InvalidContentException
- if type cannot be confirmed or detected.IOException
Copyright © 2008–2021 Sonatype, Inc.. All rights reserved.