Example usage for com.google.common.net MediaType XHTML_UTF_8

List of usage examples for com.google.common.net MediaType XHTML_UTF_8

Introduction

In this page you can find the example usage for com.google.common.net MediaType XHTML_UTF_8.

Prototype

MediaType XHTML_UTF_8

To view the source code for com.google.common.net MediaType XHTML_UTF_8.

Click Source Link

Usage

From source file:org.sonatype.nexus.repository.storage.DefaultContentValidator.java

/**
 * Circumvention if mime type covers HTML: Reason for exceptional handling HTML is due to XHTML (augmented with +xml,
 * basically subtype of XML) and "plain" HTML. They are not related in any way (supertype or alias) in registry but
 * still both represent "html" (as general term) in what we are interested to perform validation.
 *//*from   w  w  w  .ja va 2 s.c  om*/
private void adjustIfHtml(final Set<String> mimeTypes) {
    if (mimeTypes.contains(MediaType.HTML_UTF_8.withoutParameters().toString())
            || mimeTypes.contains(MediaType.XHTML_UTF_8.withoutParameters().toString())) {
        // to circumvent on xhtml vs html, we will treat both as text/html which is okay for content validation purposes
        mimeTypes.add(ContentTypes.TEXT_HTML);
    }
}