title: Jersey 2 POST and PUT parameter is null
body: <p>I have a problem with my jersey rest service when method is PUT or POST. The problem is that parameter is null. I test with angularjs and jersey-test-framework with same result, the parameter is null.</p>
  
  <p>I thought the problem was due to the header "Content-Type" but I add this in my test with the same result.</p>
  
  <p><strong>Jersey version</strong>: 2.14</p>
  
  <p><strong>Jersey modules</strong>: jersey-container-servlet, jersey-spring3, jersey-media-json-jackson</p>
  
  <p>My application config and object mapper:</p>
  
  <pre><code>public class CustomObjectMapper implements ContextResolver&lt;ObjectMapper&gt; {
  
     final ObjectMapper defaultObjectMapper;
  
     public CustomObjectMapper() {
        defaultObjectMapper = createDefaultMapper();
     }
  
     @Override
     public ObjectMapper getContext(final Class&lt;?&gt; type) {
        return defaultObjectMapper;
     }
  
     private static ObjectMapper createDefaultMapper() {
        final ObjectMapper result = new ObjectMapper();
  
        return result;
     }
  
  }
  
  @ApplicationPath("/")
  public class ApplicationConfig extends ResourceConfig {
  
     public ApplicationConfig() {
        packages("es.fjtorres.cpFacturas.server.api.impl",
              "es.fjtorres.cpFacturas.server.config",
              "es.fjtorres.cpFacturas.server.filter",
              "com.fasterxml.jackson.jaxrs");
  
        property(
             "jersey.config.beanValidation.enableOutputValidationErrorEntity.server",
              true);
  
        register(CustomObjectMapper.class);
        register(JacksonFeature.class);
     }
  }
  </code></pre>
  
  <p>My resource partial code:</p>
  
  <pre><code>@Named
  @Path(CUSTOMERS_PATH)
  @Produces(MediaType.APPLICATION_JSON)
  public class CustomerResourceImpl extends AbstractResource implements
        ICustomerResource 
  
     ...
  
     @Override
     @POST
     @Consumes(MediaType.APPLICATION_JSON)
     public Response add(final CustomerDto pDto) {
        try {
           getService().add(pDto);
        } catch (final ValidationException ve) {
           badRequest(ve.getErrors());
        }
  
        return Response.ok().build();
     }
  
  }
  </code></pre>
  
  <p>My unit test:</p>
  
  <pre><code>@Test
  public void addTest() {
      final Response response = target(NameTokens.CUSTOMERS_PATH).request()
              .header("Content-Type", MediaType.APPLICATION_JSON)
              .post(Entity.entity(new CustomerDto(), MediaType.APPLICATION_JSON));
  
      Assert.assertNotNull(response, "Response cannot be null");
      Assert.assertEquals(response.getStatus(), Status.OK.getStatusCode(),
              "Response status code isn't ok");
  }
  </code></pre>