Eran Medan
Eran Medan

Reputation: 45715

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> 

Upvotes: 5

Views: 7571

Answers (2)

Eran Medan
Eran Medan

Reputation: 45715

It seems there is no special configuration, it accepts any application/json requests out of the box, I was suspecting the wrong issue.

See this other question of mine, it has the original issue and the surprising silly solution: JQuery, Spring MVC @RequestBody and JSON - making it work together

Upvotes: 0

Femi
Femi

Reputation: 64700

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.

Upvotes: 1

Related Questions