Fix IE return JSON hint download responseentity method

Source: Internet
Author: User

JS with Java SPRINGMVC background, after successful return message, Chrom FF is normal, only after IE submitted JSON prompt to return to download, view type

Application/json Google found that the original is IE does not support the logo, so as a file download

There are generally three ways to do this online:

One is to specify response manually

Second, modify the configuration file (but I have been successful in the experiment)

Three is no longer use @ResponseBody, the use of responseentity<t> this method is the highest success rate, but the change is more troublesome, if you have a lot of places have been used @ResponseBody words.

I'm using the third kind of

The responseentity<t> T type can be any, but note is the same as return, the modified return type becomes

Key value
Content-typetext/plain;charset=utf-8

IE normal identification, solve

@RequestMapping (value = "/")
Public responseentity<map<string, object>>
Updateuserpic (HttpSession session,httpservletresponse response) throws IOException {
map<string, object> map = new hashmap<string, object> ();


httpheaders headers = new Httpheaders ();
Headers.setcontenttype (Mediatype.text_plain);

return new responseentity<map<string, object>> (Map, headers, httpstatus.ok);

}

Fix IE return JSON hint download responseentity method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.