0

have an application here which is using @JsonViews to manipulation the json output of entities from webservices.

public class Customer implements Serializable {

@Id
@JsonView(ListView.class)
private String customerID;

@NotNull
@Size(min = 3)
@JsonView(DetailView.class)
private String companyName;

Webservice-Method:

    @POST
// also tested but not working with @JsonView(DetailView.class)
public Customer updateCustomer(Customer customer) {
    return customerService.updateCustomer(customer);
}

All worked fine in Wildfly 8 and 9, but on Wildfly 10 the "customer" Object only have "null" values when we post a customer. When i remove "@JsonViews" from the Customer-Object the properties without any jsonview will be used correctly.

Any ideas why Wildfly 10 has another behaving as the previous versions and how to fix it?

Thanks a lot

PS: GET Requestes with JSONViews work as expected

@GET
@JsonView(DetailView.class)
public Customer getCustomerById....
Rob
  • 14,746
  • 28
  • 47
  • 65
Hemant Desusa
  • 181
  • 2
  • 6

1 Answers1

0

@JSONView for deserialization is allowed since Jackson 2.5. If the datamodel is using JSONView it seems that you have to declare the json view you want to use while post/put, BUT at parameter level:

@POST
public Customer updateCustomer( @JsonView(DetailView.class) Customer customer) { ...

Wildfly 9 is using Jackson 2.4.X = JSONView is not supported for deserialization, so here it is working as i expected.

Hemant Desusa
  • 181
  • 2
  • 6