title: Jersey sends xml instead of json
body: <p>I am using JAVA and Jersey library to send requests to external REST service. Application is deployed on weblogic. I noticed that sometimes ( it is about 1% of all requests) , xml is sent instead of JSON. </p>
  
  <p>Client is from package com.sun.jersey.api.client. </p>
  
  <pre><code> Client client = new Client();
   client.addFilter(new CustomFilter(logger));
   WebResource resource = client.resource(url);
  
   WebResource.Builder builder = resource.type(MediaType.APPLICATION_JSON)
   builder.post(ClientResponse.class, request)
  </code></pre>
  
  <p>Above request object is custom class with annotation : @XmlRootElement. 
  CustomFilter extends ClientFilter. </p>
  
  <p>In the logs I can see:</p>
  
  <pre><code>2020-03-01T14:12:42
  &gt; POST https://api/resource
  &gt; Content-Type: application/json
  {"attr1":"1","attr2":"2"}
  |
  2020-03-01T14:12:53
  &gt; POST https://api/resource
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;customRequest&gt;&lt;attr1&gt;1&lt;/attr1&gt;&lt;attr2&gt;2&lt;/attr2&gt;&lt;/customRequest&gt;
  </code></pre>
  
  <p>Timeout on client is set to 10 seconds. As you can see time between JSON request and XML request is 11 seconds. Response is returned after XML request. So it looks that JSON was not sent at all. </p>
  
  <p>Jersey version is 1.19.1 .Is it bug in Jersey ? </p>