jquery uploadify在IE上傳報406HttpError

來源:互聯網
上載者:User

標籤:res   data-   port   直接   net   utf-8   app   str   erro   

前端使用uploadify的flash上傳控制項,後端使用spring MVC,使用IE上傳時報406,用Chrome沒有問題。

 

 

檢查發現IE上傳時的要求標頭中,Accept: text/*

而Chrome的要求標頭中,Accept: */*

 

後端返回@ResponseBody MyClass,使用JacksonHttpMessageConverter轉換成JSON返回給用戶端。最早是使用@ResponseBody String的方式直接給客戶返回一個JSON字串,當時沒有出現這個問題。

 

檢查了一下上傳成功後返回的頭,發現Content-type: application/json,於是猜想問題在訊息轉換時出現的,檢查JacksonHttpMessageConverter相關配置,發現在配置的時候設定的supportedMediaTypes只有application/json

 

[html] view plain copy 
  1. <mvc:annotation-driven>  
  2.     <mvc:message-converters>  
  3. <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">  
  4.                 <property name="supportedMediaTypes">  
  5.                     <list>  
  6.                         <value>application/json; charset=UTF-8</value>  
  7.                         <value>text/html;charset=UTF-8</value>  
  8.                    </list>  
  9.                 </property>  
  10.             </bean>  
  11.     </mvc:message-converters>  
  12. </mvc:annotation-driven>  

jquery uploadify在IE上傳報406HttpError

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.