Example usage for org.springframework.util MimeType MimeType

List of usage examples for org.springframework.util MimeType MimeType

Introduction

In this page you can find the example usage for org.springframework.util MimeType MimeType.

Prototype

public MimeType(String type, String subtype, @Nullable Map<String, String> parameters) 

Source Link

Document

Create a new MimeType for the given type, subtype, and parameters.

Usage

From source file:de.metas.ui.web.debug.DebugRestController.java

@PostMapping("/websocket/post")
public void postToWebsocket(@RequestParam("endpoint") final String endpoint,
        @RequestBody final String messageStr) {
    final Charset charset = Charset.forName("UTF-8");
    final Map<String, Object> headers = ImmutableMap.<String, Object>builder()
            .put("simpMessageType", SimpMessageType.MESSAGE)
            .put("contentType", new MimeType("application", "json", charset)).build();
    final Message<?> message = new GenericMessage<>(messageStr.getBytes(charset), headers);
    websocketMessagingTemplate.send(endpoint, message);
}

From source file:org.springframework.cloud.aws.messaging.support.converter.ObjectMessageConverter.java

public ObjectMessageConverter(String encoding) {
    super(new MimeType("application", "x-java-serialized-object", Charset.forName(encoding)));
    this.encoding = Charset.forName(encoding);
}

From source file:org.springframework.cloud.aws.messaging.support.converter.ObjectMessageConverterTest.java

private static MessageHeaders getMessageHeaders(String charsetName) {
    return new MessageHeaders(Collections.<String, Object>singletonMap(MessageHeaders.CONTENT_TYPE,
            new MimeType("application", "x-java-serialized-object", Charset.forName(charsetName))));
}