Search in sources :

Example 1 with WireFeedInput

use of com.rometools.rome.io.WireFeedInput in project spring-framework by spring-projects.

the class AbstractWireFeedHttpMessageConverter method readInternal.

@Override
@SuppressWarnings("unchecked")
protected T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException {
    WireFeedInput feedInput = new WireFeedInput();
    MediaType contentType = inputMessage.getHeaders().getContentType();
    Charset charset = (contentType != null && contentType.getCharset() != null ? contentType.getCharset() : DEFAULT_CHARSET);
    try {
        Reader reader = new InputStreamReader(inputMessage.getBody(), charset);
        return (T) feedInput.build(reader);
    } catch (FeedException ex) {
        throw new HttpMessageNotReadableException("Could not read WireFeed: " + ex.getMessage(), ex);
    }
}
Also used : WireFeedInput(com.rometools.rome.io.WireFeedInput) HttpMessageNotReadableException(org.springframework.http.converter.HttpMessageNotReadableException) InputStreamReader(java.io.InputStreamReader) FeedException(com.rometools.rome.io.FeedException) MediaType(org.springframework.http.MediaType) Charset(java.nio.charset.Charset) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader)

Aggregations

FeedException (com.rometools.rome.io.FeedException)1 WireFeedInput (com.rometools.rome.io.WireFeedInput)1 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 Charset (java.nio.charset.Charset)1 MediaType (org.springframework.http.MediaType)1 HttpMessageNotReadableException (org.springframework.http.converter.HttpMessageNotReadableException)1