Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any special configuration to cause "application/json" mime type to be accepted Tomcat 6.0 (Spring MVC 3.0)?

Is there any special configuration one must do? or should it work out of the box?

e.g. should I add something like this to make it work?

 <mime-mapping>
    <extension>json</extension>
    <mime-type>application/json</mime-type>
</mime-mapping> 
like image 754
Eran Medan Avatar asked Nov 14 '22 23:11

Eran Medan


1 Answers

If you are trying to make Tomcat serve .json files with the right mime type then yes, you will need to add that mime type declaration to the conf/web.xml file.

If you're serving dynamically generated JSON then it really shouldn't matter: you can set any mime type using the setContentType function.

like image 141
Femi Avatar answered Nov 16 '22 16:11

Femi