Example usage for org.springframework.http MediaType MediaType

List of usage examples for org.springframework.http MediaType MediaType

Introduction

In this page you can find the example usage for org.springframework.http MediaType MediaType.

Prototype

public MediaType(String type, String subtype, @Nullable Map<String, String> parameters) 

Source Link

Document

Create a new MediaType for the given type, subtype, and parameters.

Usage

From source file:org.unitedinternet.cosmo.dav.property.ContentType.java

private static String mt(String type, String encoding) {
    final MediaType mediaType = MediaType.parseMediaType(type);
    if (StringUtils.hasText(encoding)) {
        return new MediaType(mediaType.getType(), mediaType.getSubtype(), Charset.forName(encoding)).toString();
    }/* w ww  . j  a  v  a  2 s  . c om*/
    return mediaType.toString();
}

From source file:io.github.autsia.crowly.tests.IntegrationTestingUtils.java

public MediaType getContentType() {
    return new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(),
            Charset.forName("utf8"));
}

From source file:cn.cuizuoli.appranking.http.converter.JsoupHttpMessageConverter.java

public JsoupHttpMessageConverter(Charset defaultCharset) {
    super(new MediaType("text", "html", defaultCharset), MediaType.ALL);
    this.defaultCharset = defaultCharset;
    this.availableCharsets = new ArrayList<Charset>(Charset.availableCharsets().values());
}

From source file:org.zht.framework.web.converter.MappingFastjsonHttpMessageConverter.java

public MappingFastjsonHttpMessageConverter() {
    super(new MediaType("application", "json", DEFAULT_CHARSET));
}

From source file:com.careerly.common.support.msgconverter.JsonpHttpMessageConverter.java

public JsonpHttpMessageConverter() {
    super(new MediaType("application", "javascript", Charset.forName("UTF-8")));
}

From source file:com.careerly.common.support.msgconverter.CsvHttpMessageConverter.java

public CsvHttpMessageConverter() {
    super(new MediaType("application", "vnd.ms-excel", Charset.forName("UTF-8")));
}

From source file:com.baomidou.framework.controller.JsonpResponseAdvice.java

@Override
protected MediaType getContentType(MediaType contentType, ServerHttpRequest request,
        ServerHttpResponse response) {/*ww w.  j av  a 2 s.  c  o  m*/
    return new MediaType("application", "javascript", contentType.getCharSet());
}

From source file:sys.core.jackson.MappingJacksonHttpMessageConverter.java

public MappingJacksonHttpMessageConverter() {
    super(new MediaType("application", "json", DEFAULT_CHARSET));
}

From source file:com.alibaba.webmvc.extension.FastJsonHttpMessageConverter.java

/**
 * Construct a new {@code MappingJacksonHttpMessageConverter}.
 *///w  ww.j  a  va 2s .  c om
public FastJsonHttpMessageConverter() {
    super(new MediaType("application", "json", DEFAULT_CHARSET),
            new MediaType("application", "*+json", DEFAULT_CHARSET));
}

From source file:curly.artifactory.ArtifactoryTestHelper.java

public static MediaType jsonMediaType() {
    return new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(),
            Charset.forName("utf-8"));
}