Exemplo n.º 1
0
  @Override
  public void configureContentNegotiation(final ContentNegotiationConfigurer configurer) {

    super.configureContentNegotiation(configurer);
    configurer.favorPathExtension(true);
    configurer.ignoreAcceptHeader(false).defaultContentType(MediaType.TEXT_HTML);
    Map<String, MediaType> mediaTypes = new HashMap<String, MediaType>();
    mediaTypes.put("html", MediaType.TEXT_HTML);
    mediaTypes.put("xml", MediaType.TEXT_XML);
    mediaTypes.put("json", new MediaType("application", "json", Charset.forName("UTF-8")));
    mediaTypes.put("atom", MediaType.APPLICATION_ATOM_XML);
    mediaTypes.put("js", new MediaType("text", "javascript"));
    configurer.mediaTypes(mediaTypes);
  }
Exemplo n.º 2
0
 @Override
 public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
   configurer.mediaTypes(
       ImmutableMap.of(
           "json", MediaType.APPLICATION_JSON,
           "html", MediaType.TEXT_HTML));
 }
Exemplo n.º 3
0
 @Override
 public void configureContentNegotiation(ContentNegotiationConfigurer cfg) {
   cfg.favorParameter(false) // disable 'resource?format=xxx'
       .favorPathExtension(false) // disable 'resource.xxx'
       .ignoreAcceptHeader(false) // use Accept header
       .defaultContentType(MediaType.TEXT_PLAIN); // (*)
 }
 @Override
 public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
   // This is necessary to prevent "406 Not Acceptable" responses for certain types of files such
   // as JavaScript,
   // CSS and images.
   // See
   // http://docs.spring.io/spring-framework/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-config-content-negotiation
   configurer.favorPathExtension(false).favorParameter(true);
 }
Exemplo n.º 5
0
 @Override
 public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
   configurer
       .favorPathExtension(true)
       .ignoreAcceptHeader(false)
       .useJaf(false)
       .defaultContentType(MediaType.TEXT_HTML)
       .mediaType("html", MediaType.TEXT_HTML)
       .mediaType("json", MediaType.APPLICATION_JSON);
 }
 /**
  * Configures the content negotiation.
  *
  * @param configurer
  */
 @Override
 public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
   configurer
       .favorPathExtension(false)
       .favorParameter(true)
       .ignoreAcceptHeader(true)
       .parameterName("format")
       .useJaf(false)
       .defaultContentType(MediaType.APPLICATION_XML)
       .mediaType("xml", MediaType.APPLICATION_XML)
       .mediaType("json", MediaType.APPLICATION_JSON);
 }
 @Override
 public void configureContentNegotiation(ContentNegotiationConfigurer c) {
   c.defaultContentType(MediaTypes.HAL_JSON);
 }
Exemplo n.º 8
0
 @Override
 public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
   configurer.defaultContentType(MediaType.APPLICATION_JSON);
 }
Exemplo n.º 9
0
 @Override
 public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
   configurer.ignoreUnknownPathExtensions(false).defaultContentType(MediaType.TEXT_HTML);
 }
Exemplo n.º 10
0
 @Override
 public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
   configurer.favorParameter(false);
   configurer.favorPathExtension(false);
 }