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:com.nextbook.config.ConfigurableStringHttpMessageConverter.java

public ConfigurableStringHttpMessageConverter(String charsetName) {
    super(new MediaType("text", "plain", Charset.forName(charsetName)), MediaType.ALL);
    defaultCharset = Charset.forName(charsetName);
    this.availableCharsets = new ArrayList<Charset>(Charset.availableCharsets().values());
}

From source file:pl.maciejwalkowiak.plist.spring.PlistHttpMessageConverter.java

/**
 * Construct a new {@code PlistHttpMessageConverter}.
 *//*w w  w.  j  a v a 2  s. c  o m*/
public PlistHttpMessageConverter(boolean addHeader) {
    super(new MediaType("application", "x-plist", DEFAULT_CHARSET),
            new MediaType("application", "x-apple-aspen-mdm-checkin", DEFAULT_CHARSET));

    this.addHeader = addHeader;
    plistSerializer = new PlistSerializerImpl();
}

From source file:edu.mayo.cts2.framework.webapp.rest.converter.MappingGsonHttpMessageConverter.java

/**
 * Instantiates a new mapping gson http message converter.
 *//*from   w  ww  .  ja  va  2 s  .c o  m*/
public MappingGsonHttpMessageConverter() {
    super(new MediaType("application", "json", DEFAULT_CHARSET));
}

From source file:com.biendltb.config.WebConfig.java

private StringHttpMessageConverter stringConverter() {
    StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
    stringConverter.setSupportedMediaTypes(Arrays.asList(new MediaType("text", "plain", UTF8)));
    return stringConverter;
}

From source file:com.e6soft.core.web.StringHttpMessageConverter.java

/**
 * A constructor accepting a default charset to use if the requested content
 * type does not specify one.//from w  w w .  j  a va2  s  . c o  m
 */
public StringHttpMessageConverter(Charset defaultCharset) {
    super(new MediaType("text", "plain", defaultCharset), MediaType.ALL);
    this.defaultCharset = defaultCharset;
    this.availableCharsets = new ArrayList<Charset>(Charset.availableCharsets().values());
}

From source file:com.cookbook.cq.dao.util.GsonHttpMessageConverter.java

/**
 * Construct a new {@code GsonHttpMessageConverter}.
 * /*from w  w  w.  j  a v a 2 s  .co m*/
 * @param gson a customized {@link Gson#Gson() Gson}
 */
public GsonHttpMessageConverter(Gson gson) {
    super(new MediaType("application", "json", DEFAULT_CHARSET));
    setGson(gson);
}

From source file:com.hbztc.middleware.util.Utf8StringHttpMessageConverter.java

/**
 * A constructor accepting a default charset to use if the requested content
 * type does not specify one./*from   w w w .j  a  va  2  s  .c  o m*/
 */
public Utf8StringHttpMessageConverter(Charset defaultCharset) {
    super(new MediaType("text", "plain", defaultCharset), MediaType.ALL);
    this.defaultCharset = defaultCharset;
    this.availableCharsets = new ArrayList<Charset>(Charset.availableCharsets().values());
}

From source file:org.n52.restfulwpsproxy.serializer.WPSBeansMessageConverter.java

public WPSBeansMessageConverter() {
    super(new MediaType("text", "xml", Charset.defaultCharset()),
            new MediaType("application", "xml", Charset.defaultCharset()));
}

From source file:org.kwet.giteway.mapper.PrettyMappingJacksonHttpMessageConverter.java

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

From source file:org.ng200.openolympus.controller.task.TaskDescriptionSourcecodeController.java

@PreAuthorize(SecurityExpressionConstants.IS_ADMIN)
@RequestMapping(value = "/api/taskSourcecode", method = RequestMethod.GET)
public @ResponseBody ResponseEntity<String> getTaskSourcecode(@RequestParam(value = "id") final Task task)
        throws IOException {
    Assertions.resourceExists(task);/*w  w w. j ava 2  s .c o m*/
    final HttpHeaders responseHeaders = new HttpHeaders();
    final Charset charset = Charset.forName("UTF-8");
    responseHeaders.setContentType(new MediaType("text", "plain", charset));
    return new ResponseEntity<String>(this.storageService.getTaskDescriptionSourcecode(task), responseHeaders,
            HttpStatus.OK);
}