• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Debugging Annotations in RestController

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 188
11
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic