Search in sources :

Example 1 with MultipartHttpInputMessage

use of org.springframework.integration.http.multipart.MultipartHttpInputMessage in project spring-integration by spring-projects.

the class MultipartAwareFormHttpMessageConverter method read.

@Override
public MultiValueMap<String, ?> read(Class<? extends MultiValueMap<String, ?>> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException {
    MediaType contentType = inputMessage.getHeaders().getContentType();
    if (!MediaType.MULTIPART_FORM_DATA.includes(contentType)) {
        return this.wrappedConverter.read(clazz, inputMessage);
    }
    Assert.state(inputMessage instanceof MultipartHttpInputMessage, "A request with 'multipart/form-data' Content-Type must be a MultipartHttpInputMessage. " + "Be sure to provide a 'multipartResolver' bean in the ApplicationContext.");
    MultipartHttpInputMessage multipartInputMessage = (MultipartHttpInputMessage) inputMessage;
    return this.readMultipart(multipartInputMessage);
}
Also used : MultipartHttpInputMessage(org.springframework.integration.http.multipart.MultipartHttpInputMessage) MediaType(org.springframework.http.MediaType)

Aggregations

MediaType (org.springframework.http.MediaType)1 MultipartHttpInputMessage (org.springframework.integration.http.multipart.MultipartHttpInputMessage)1