• Post Reply Bookmark Topic Watch Topic
  • New Topic

Debugging Annotations in RestController

 
Prashanth Nair
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have been using @ResponseBody annotations for the RESTControllers in our application.Our application serves as a layer between mobile Request and an EJB service layer. As we are leveraging a legacy system, we often try to reuse the same DTOs from the EJB side to cast the objects that are given to the mobile in response. We are using @ResponseBody to send the output as JSON.And many a time, we have issues when a DTO has another sub DTO which doesn't have values/improper values which would cause a "406" on a REST request. . We try to debug this by instantiating the Object mapper itself ObjectMapper

Is there a better way to debug this issue?

Thanks
Prashanth
 
Amritendu De
author
Ranch Hand
Posts: 188
11
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am unable to understand what solution you are looking for? I use POSTMAN (Google Chrome extension) when working with REST service. I start the server in Debug mode.
 
Prashanth Nair
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amritendu,

Thanks for the reply.

I also use RestClient in chrome browser something like Postman. Putting my question in general terms, how could we debug if there is some issue with message converters while using an Annotation like @ResponseBody?. In my case i am using jackson internally in my configuration , so that the Response from the Controller would be of Json format. My configuration has the following for Json conversion which is used by @ResponseBody



So we may need to put back the code (which i pasted in previous post) to see exactly at which point the error is happening while a DTO is coverted into a message. As you said, i have the server in debug mode and would be able to see the point of error.My question is, is there a better way for this debugging.

Thanks
Prashanth
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!