Posts

Showing posts from June, 2015

My rendezvous with Message Converters

Recently I have been exploring Spring @ResponseBody . My objective was to create a Handler Method, which will return content depending on the Accept header sent along with the request, i.e. if the request has application/json in the Accept header then the content returned will be in json format, if there is application/xml in the accept header then the content returned will be in xml format and so on. So in order to fulfill my objective, I annotated the Handler method with @ResponseBody , and using &ltmvc:annotation-driven/&gt in the Spring Configuration, automatically registers all the default HttpMessageConverters in the Application Context. So with all of my configurations in place, when I tried to invoke the Handler method (with Accept Header - application/json) , I surprisingly got error code 406 - Not Acceptable . But I could not understand the issue behind this case as all the configurations are in place, and the HttpMessageConverters are not getting kicke