Search in sources :

Example 1 with CharSetXMLWriter

use of org.apache.ws.commons.serialize.CharSetXMLWriter in project camel by apache.

the class XmlRpcDataFormat method getXMLWriter.

protected XMLWriter getXMLWriter(Exchange exchange, OutputStream outputStream) throws XmlRpcException {
    XMLWriter writer = new CharSetXMLWriter();
    String encoding = IOHelper.getCharsetName(exchange);
    writer.setEncoding(encoding);
    writer.setIndenting(false);
    writer.setFlushing(true);
    try {
        writer.setWriter(new BufferedWriter(new OutputStreamWriter(outputStream, encoding)));
    } catch (UnsupportedEncodingException e) {
        throw new XmlRpcException("Unsupported encoding: " + encoding, e);
    }
    return writer;
}
Also used : UnsupportedEncodingException(java.io.UnsupportedEncodingException) CharSetXMLWriter(org.apache.ws.commons.serialize.CharSetXMLWriter) OutputStreamWriter(java.io.OutputStreamWriter) CharSetXMLWriter(org.apache.ws.commons.serialize.CharSetXMLWriter) XMLWriter(org.apache.ws.commons.serialize.XMLWriter) XmlRpcException(org.apache.xmlrpc.XmlRpcException) BufferedWriter(java.io.BufferedWriter)

Aggregations

BufferedWriter (java.io.BufferedWriter)1 OutputStreamWriter (java.io.OutputStreamWriter)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 CharSetXMLWriter (org.apache.ws.commons.serialize.CharSetXMLWriter)1 XMLWriter (org.apache.ws.commons.serialize.XMLWriter)1 XmlRpcException (org.apache.xmlrpc.XmlRpcException)1