Skip to content

Commit

Permalink
Merge pull request #55 from assimbly/54-formtoxml-component-content-type
Browse files Browse the repository at this point in the history
FormtoXml - set content-type as application/xml
  • Loading branch information
skin27 authored Sep 29, 2023
2 parents bfa3f20 + 5adf301 commit ae706e7
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.assimbly.formtoxml.converter.XstreamMapEntryConverter;
import org.springframework.http.MediaType;

import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
Expand Down Expand Up @@ -49,6 +50,8 @@ public void process(Exchange exchange) throws Exception {
xStream.toXML(items, writer);

String xml = outputStream.toString(configuration.getEncoding());

exchange.getIn().setHeader(Exchange.CONTENT_TYPE, MediaType.APPLICATION_XML_VALUE);
exchange.getIn().setBody(xml);
}
}
Expand Down

0 comments on commit ae706e7

Please sign in to comment.