Hi all
I already tried to write a custom implementation of a HttpMessageConverter which removes all linefeeds:
Code:
public class LinefeedMessageConverter extends AbstractXmlHttpMessageConverter {
private static final Logger LOG = LoggerFactory.getLogger(LinefeedMessageConverter.class);
/**
*
*/
@Override
protected Object readFromSource(Class clazz, HttpHeaders headers, Source source) throws IOException {
InputStream stream = ((StreamSource) source).getInputStream();
if (source == null) {
throw new MessageMappingException("No message data found!");
}
// can't use the encoding of the incoming request here.
String payload = IOUtils.toString(stream);
payload = stripNonValidXMLCharacters(payload);
MessageBuilder<String> builder = MessageBuilder.withPayload(payload);
return builder.toString();
}
......
}
Configuration:
Code:
<bean id="linefeedMessageConverter" class="com.namics.wetteralarm.queue.endpoint.LinefeedMessageConverter"/>
<si-http:inbound-channel-adapter id="sfmeteo" channel="sFMeteoInboundChannel" supported-methods="POST"
message-converters="linefeedMessageConverter"/>
But I get the following exception:
Code:
26.10.11 09:52:40 56016 ERROR [task-scheduler-1] com.namics.wetteralarm.service.ErrorServiceImpl - [Payload=org.springframework.integration.transformer.MessageTransformationException: failed to transform message][Headers={timestamp=1319615560389, id=09718a5a-52ec-4676-93ff-43943f9e880b}]
So you have any ideas where the problem is? I'm also missing a good documentation about these MessageConverters.
Regards
Angela