Example usage for org.springframework.http MediaType APPLICATION_JSON_UTF8

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

Introduction

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

Prototype

MediaType APPLICATION_JSON_UTF8

To view the source code for org.springframework.http MediaType APPLICATION_JSON_UTF8.

Click Source Link

Document

Public constant media type for application/json;charset=UTF-8 .

Usage

From source file:org.springframework.cloud.gateway.test.GatewayIntegrationTests.java

@Test
public void complexContentTypeWorks() {
    Mono<Map> result = webClient.get().uri("/headers").contentType(MediaType.APPLICATION_JSON_UTF8)
            .header("Host", "www.complexcontenttype.org").exchange()
            .then(response -> response.body(toMono(Map.class)));

    StepVerifier.create(result).consumeNextWith(response -> {
        Map<String, Object> headers = getMap(response, "headers");
        assertThat(headers).containsEntry(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE);
    }).expectComplete().verify(DURATION);
}

From source file:org.springframework.integration.aws.inbound.SnsInboundChannelAdapter.java

public SnsInboundChannelAdapter(AmazonSNS amazonSns, String... path) {
    super(false);
    Assert.notNull(amazonSns, "'amazonSns' must not be null.");
    Assert.notNull(path, "'path' must not be null.");
    Assert.noNullElements(path, "'path' must not contain null elements.");
    this.notificationStatusResolver = new NotificationStatusResolver(amazonSns);
    RequestMapping requestMapping = new RequestMapping();
    requestMapping.setMethods(HttpMethod.POST);
    requestMapping.setHeaders("x-amz-sns-message-type");
    requestMapping.setPathPatterns(path);
    this.jackson2HttpMessageConverter
            .setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON_UTF8, MediaType.TEXT_PLAIN));
    super.setRequestMapping(requestMapping);
    super.setStatusCodeExpression(new ValueExpression<>(HttpStatus.NO_CONTENT));
    super.setMessageConverters(
            Collections.<HttpMessageConverter<?>>singletonList(this.jackson2HttpMessageConverter));
    super.setRequestPayloadType(HashMap.class);
}