springMVC3.2 多视图解析器 java.lang.String cannot be cast to org.springframework.http.MediaType
2017-09-26 10:41
495 查看
SpringMVC 3.2 org.springframework.web.servlet.view.ContentNegotiatingViewResolver 配置如下mediaType报错 <property name="mediaTypes"> <map> <entry key="pdf" value="application/pdf"/> <entry key="html" value="text/html"/> <entry key="json" value="application/json"/> </map> </property> 换成
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <property name="contentNegotiationManager"> <bean class="org.springframework.web.accept.ContentNegotiationManager"> <constructor-arg> <list> <!-- These are evaluated in order --> <!-- Is there a media type based on suffix? --> <bean class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy"> <constructor-arg> <map> <entry key="html" value="text/html" /> <entry key="json" value="application/json" /> <entry key="pdf" value="application/pdf" /> </map> </constructor-arg> </bean> <!-- Else use request header --> <bean class="org.springframework.web.accept.HeaderContentNegotiationStrategy"> </bean> </list> </constructor-arg> </bean> </property> </bean>
相关文章推荐
- java.lang.String cannot be cast to org.springframework.http.MediaType 异常分析
- java.lang.ClassCastException: org.springframework.web.filter.CharacterEncodingFilter cannot be cast to javax.servlet.Filter
- 在maven项目中使用apache cxf中遇到异常 java.lang.ClassCastException: org.springframework.web.filter.CharacterEncodingFilter cannot be cast to javax.servlet.Filter
- 异常-----springmvc + ajaxfileupload解决ajax不能异步上传图片的问题。java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade cannot be cast to org.springframework.web.multipart.
- Caused by: java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hiberna
- Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer错误解决办法
- Caused by: java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hiberna
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONArra
- org.json.JSONException: Value ok of type java.lang.String cannot be converted to JSONObject: [Caugh
- Tomcat7出现HTTP Status 500 - java.lang.ClassCastException: org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.
- cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest
- java.lang.ClassCastException: org.springframework.web.filter.CharacterEncodingFilter cannot be cast
- cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSON
- nested exception is java.lang.NoSuchMethodError: org.springframework.http.MediaType.getCharset()
- org.json.JSONException: Value of type java.lang.String cannot be converted to JSONArra
- Tomcat7出现HTTP Status 500 - java.lang.ClassCastException: org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.el.ELContextImpl的解决
- Failed to convert value of type 'java.lang.String' to required type 'org.springframework.web.multipa
- java.lang.ClassCastException: org.apache.shiro.web.servlet.ShiroHttpServletRequest cannot be cast to