title: Jersey Http Client replying with 411 on POST request
body: <p>I'm using Jersey HTTP Client for sending POST request and receiving 411 Content Length missing in response. 
  However this error is not thrown in all the cases. There are some calls where I'm using json content type and it is working fine. </p>
  
  <p>For this particular request where I'm sending the request to a specific URL I'm receiving 411 Content Length required. While with the same payload when I'm using a different URL it is working fine.</p>
  
  <p>This is how I'm setting Form Entity in Jersey Client Request</p>
  
  <pre><code>public static MultivaluedMap&lt;String, String&gt; getMultivaluedMapRequest(Map&lt;String, String&gt; map) {
      MultivaluedMap&lt;String, String&gt; bodyParams = new MultivaluedHashMap&lt;String, String&gt;();
  
      if (null != map &amp;&amp; map.size() &gt; 0) {
          for (Entry&lt;String, String&gt; param : map.entrySet()) {
              bodyParams.add(param.getKey(), param.getValue());
          }
      }
      return bodyParams;
  }
  
  private static Entity&lt;?&gt; getRequestEntity(final HttpRequestPayload&lt;?&gt; payload) {
      if (payload.getEntity() instanceof MultivaluedMap&lt;?, ?&gt;) {
          return Entity.form((MultivaluedMap&lt;String, String&gt;) payload.getEntity());
      } else {
          return Entity.entity(payload.getEntity(), payload.getMediaTypeProduced());
      }
  }
  </code></pre>
  
  <p>This is how the call is made</p>
  
  <pre><code>final Entity&lt;?&gt; entity = getRequestEntity(payload);
  
  Response response = target.request(payload.getMediaTypeConsumed()).headers(payload.getHeaders()).post(entity);
  </code></pre>
  
  <p>I'm not sure what the issue is. I think it has something to do with the URL I'm sending the request to.</p>