Question

I have a code block like

    final Invocation.Builder builder = webTarget.request();
    final Entity<IFSRequestPresentation> entity = Entity.entity(ifsRequestPresentation, MediaType.APPLICATION_JSON);
    final Response response = builder.post(entity);

The server (which is external to me and I can't see logs) is not returning me the data I expect. I believe that the json payload is not good

The IFSRequestPresentation is quite complex and I would like to see how it is represented as json String.

I am using Spring(4.0.3) and Jersey(2.8).

Is there a way I can log builder.post(entity) method? or at least see what entity looks like as json String?

Was it helpful?

Solution

I wrote it to file like

mapper.writeValue(new File("my.json"), IFSRequestPresentation);

as per Jackson documentation and got the json written to that file

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top