I'm working with Spring mvc 4 and glassfish 4 and I had some problems with ajax calls to return object as json, with @ResponseBody. Then I found a proper solution HTTP Status 406. Spring MVC 4.0, jQuery, JSON that it did not totally work on my project I think because my servlet-mapping.
My servlet mapping was:
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
But I want also to serve the request like /* to avoid problems with 406 http code so I've tried this:
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
But then the dispatcher also maps the *.jsp and breaks At the end I've tried this:
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
But then the dispatcher maps the *.js and *.css like bootstrap, jquery etc.
And now I ran out of ideas.