Examples of resolveMediaTypes()


Examples of org.springframework.web.accept.ContentNegotiationManager.resolveMediaTypes()

  public void addMediaTypes() throws Exception {
    this.configurer.mediaTypes(Collections.singletonMap("json", MediaType.APPLICATION_JSON));
    ContentNegotiationManager manager = this.configurer.getContentNegotiationManager();

    this.servletRequest.setRequestURI("/flower.json");
    assertEquals(Arrays.asList(MediaType.APPLICATION_JSON), manager.resolveMediaTypes(this.webRequest));
  }

  @Test
  public void favorParameter() throws Exception {
    this.configurer.favorParameter(true);
View Full Code Here

Examples of org.springframework.web.accept.ContentNegotiationManager.resolveMediaTypes()

    ContentNegotiationManager manager = this.configurer.getContentNegotiationManager();

    this.servletRequest.setRequestURI("/flower");
    this.servletRequest.addParameter("f", "json");

    assertEquals(Arrays.asList(MediaType.APPLICATION_JSON), manager.resolveMediaTypes(this.webRequest));
  }

  @Test
  public void ignoreAcceptHeader() throws Exception {
    this.configurer.ignoreAcceptHeader(true);
View Full Code Here

Examples of org.springframework.web.accept.ContentNegotiationManager.resolveMediaTypes()

    ContentNegotiationManager manager = this.configurer.getContentNegotiationManager();

    this.servletRequest.setRequestURI("/flower");
    this.servletRequest.addHeader("Accept", MediaType.IMAGE_GIF_VALUE);

    assertEquals(Collections.emptyList(), manager.resolveMediaTypes(this.webRequest));
  }

  @Test
  public void setDefaultContentType() throws Exception {
    this.configurer.defaultContentType(MediaType.APPLICATION_JSON);
View Full Code Here

Examples of org.springframework.web.accept.ContentNegotiationManager.resolveMediaTypes()

  @Test
  public void setDefaultContentType() throws Exception {
    this.configurer.defaultContentType(MediaType.APPLICATION_JSON);
    ContentNegotiationManager manager = this.configurer.getContentNegotiationManager();

    assertEquals(Arrays.asList(MediaType.APPLICATION_JSON), manager.resolveMediaTypes(this.webRequest));
  }

  @Test
  public void setDefaultContentTypeStrategy() throws Exception {
    this.configurer.defaultContentTypeStrategy(new FixedContentNegotiationStrategy(MediaType.APPLICATION_JSON));
View Full Code Here

Examples of org.springframework.web.accept.ContentNegotiationManager.resolveMediaTypes()

  @Test
  public void setDefaultContentTypeStrategy() throws Exception {
    this.configurer.defaultContentTypeStrategy(new FixedContentNegotiationStrategy(MediaType.APPLICATION_JSON));
    ContentNegotiationManager manager = this.configurer.getContentNegotiationManager();

    assertEquals(Arrays.asList(MediaType.APPLICATION_JSON), manager.resolveMediaTypes(this.webRequest));
  }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.