Example usage for org.springframework.util MimeType getParameter

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

Introduction

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

Prototype

@Nullable
public String getParameter(String name) 

Source Link

Document

Return a generic parameter value, given a parameter name.

Usage

From source file:org.springframework.integration.x.bus.MessageBusSupport.java

private Object deserializePayload(byte[] bytes, MimeType contentType) {
    Class<?> targetType = null;
    try {// w w  w.j  av a 2s  .co m
        if (contentType.equals(TEXT_PLAIN)) {
            return new String(bytes, "UTF-8");
        }
        targetType = Class.forName(contentType.getParameter("type"));

        return codec.deserialize(bytes, targetType);
    } catch (ClassNotFoundException e) {
        throw new SerializationException("unable to deserialize [" + targetType + "]. Class not found.", e);
    } catch (IOException e) {
        throw new SerializationException("unable to deserialize [" + targetType + "]", e);
    }

}