Example usage for org.springframework.web.servlet.config.annotation ContentNegotiationConfigurer defaultContentType

List of usage examples for org.springframework.web.servlet.config.annotation ContentNegotiationConfigurer defaultContentType

Introduction

In this page you can find the example usage for org.springframework.web.servlet.config.annotation ContentNegotiationConfigurer defaultContentType.

Prototype

public ContentNegotiationConfigurer defaultContentType(MediaType... defaultContentTypes) 

Source Link

Document

Set the default content type(s) to use when no content type is requested in order of priority.

Usage

From source file:cn.edu.zjnu.acm.judge.config.JudgeWebMvcConfiguration.java

@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.TEXT_HTML);
}

From source file:com.videohub.configuration.WebConfiguration.java

@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(DEFAULT_CONTENT_TYPE).mediaType(MEDIA_TYPE_NAME, MEDIA_TYPE)
            .favorPathExtension(false);/*from   ww  w . j a  va 2  s . c o m*/
}

From source file:com.coffeebeans.services.config.MvcConfig.java

@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.APPLICATION_JSON);
}

From source file:com.torchmind.stockpile.server.configuration.WebMvcConfiguration.java

/**
 * {@inheritDoc}/*  w  w w .  j av a 2s .c om*/
 */
@Override
public void configureContentNegotiation(@Nonnull ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.APPLICATION_JSON_UTF8);
    configurer.mediaType("json", MediaType.APPLICATION_JSON_UTF8);
    configurer.mediaType("xml", MediaType.APPLICATION_XML);
    configurer.favorPathExtension(true);
    configurer.ignoreUnknownPathExtensions(true);
    configurer.ignoreAcceptHeader(false);
}

From source file:com.init.MvcConfiguration.java

@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.TEXT_HTML).mediaType("json", MediaType.APPLICATION_JSON)
            .mediaType("xml", MediaType.APPLICATION_XML).favorPathExtension(true); // default is true. just for clarity
}

From source file:gov.nyc.doitt.gis.geoclient.service.configuration.WebConfig.java

/**
 * Set JSON as the default content type that gets returned
 * /*from   ww w .  ja v  a  2 s. c  o m*/
 * @see org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter#configureContentNegotiation(org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer)
 */
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.defaultContentType(MediaType.APPLICATION_JSON).favorPathExtension(true);
}

From source file:com.kixeye.chassis.transport.SpringMvcConfiguration.java

@Override
protected void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    // default to JSON
    configurer.defaultContentType(MediaType.APPLICATION_JSON);
}

From source file:de.interseroh.report.webconfig.WebMvcConfig.java

@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.favorPathExtension(false);
    configurer.ignoreAcceptHeader(false);
    configurer.defaultContentType(MediaType.TEXT_PLAIN);

    configurer.mediaType("html", MediaType.TEXT_HTML);
    configurer.mediaType("xml", MediaType.APPLICATION_XML);
}

From source file:com.mentat.rest.web.WebConfiguration.java

/**
 * Setup a simple strategy: use all the defaults and return XML by default when not sure.
 *//*w  ww . j  a va 2  s.  co m*/
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    // configurer.favorPathExtension(false).
    // favorParameter(false).
    // parameterName("mediaType").
    // ignoreAcceptHeader(false).
    // useJaf(false).
    // defaultContentType(MediaType.APPLICATION_JSON).
    // mediaType("xml", MediaType.APPLICATION_XML).
    // mediaType("json", MediaType.APPLICATION_JSON);
    configurer.defaultContentType(MediaType.APPLICATION_XML);
}