title: Modify the JSON output with Mule and Jersey
body: <p>My goal is stupidly simple. 
  I just want to wrap a json response from Jersey module in Mule in a JSON response such that: </p>
  
  <pre><code>{"status": "ok", message:&lt;json-message&gt;}
  </code></pre>
  
  <p>I tried to use a custom-transformer: </p>
  
  <pre><code>&lt;flow name="sicsRest" doc:name="sicsRest"&gt;
      &lt;inbound-endpoint address="http://localhost:65432/RestServices" 
          exchange-pattern="request-response" doc:name="RestEntry" /&gt;
      &lt;jersey:resources doc:name="REST"&gt;
          &lt;component doc:name="Java"&gt;
              &lt;spring-object bean="serviceImpl" /&gt;
          &lt;/component&gt;
          &lt;custom-transformer returnClass="java.lang.String" 
              class="com.hyperborea.sicsbus.transformer.JsonTransformer" 
              doc:name="JsonTransformer" /&gt;
          &lt;jersey:exception-mapper 
              class="com.hyperborea.sicsbus.exception.JsonRestExceptionMapper" /&gt;
      &lt;/jersey:resources&gt;
  &lt;/flow&gt;
  </code></pre>
  
  <p>The transformer class:</p>
  
  <pre><code>public class JsonTransformer extends AbstractTransformer {
      @Override 
      protected Object doTransform(Object src, String enc) 
      throws TransformerException {
          return "{\"status\":\"ok\", \"message\":\"" + src + "\"}";
      }
  }
  </code></pre>
  
  <p>Unfortunately it raises an exception during Mule startup: </p>
  
  <pre><code>org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'custom-transformer'. One of '{"http://www.mulesoft.org/schema/mule/core":abstract-component, "http://www.mulesoft.org/schema/mule/jersey":exception-mapper}' is expected.
  </code></pre>
  
  <p>Any suggestion?</p>