This is a migrated thread and some comments may be shown as answers.

[Solved] Httpnotsupportedmediatypee exception on read with json using spring

1 Answer 224 Views
Grid
This is a migrated thread and some comments may be shown as answers.
zain
Top achievements
Rank 1
zain asked on 31 Dec 2014, 06:44 PM
http://www.coderanch.com/t/644227/Spring/Httpmedianotsupported-type-exception-kendoui#2962270

If you check my thread there

<%@taglib prefix="kendo" uri="http://www.kendoui.com/jsp/tags"%>  <%@taglib prefix="demo" tagdir="/WEB-INF/tags"%>  <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  <%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>    <html xmlns="http://www.w3.org/1999/xhtml">      <head>          <%@include file="jspf/meta.jspf" %>            <!-- title -->          <title><spring:message code='APPNAME' text='Martinez' /> - <spring:message code='ASSETS' text='Assets' /></title>            <!-- kendo ui styles -->          <link rel="stylesheet" type="text/css" href="<spring:url value='/assets/kendoui/styles/kendo.common.min.css'/>">              <link rel="stylesheet" type="text/css" href="<spring:url value='/assets/kendoui/styles/kendo.material.min.css'/>">                    <!-- kendo ui scripts -->                     <script type="text/javascript" src="<spring:url value='/assets/sm/js/jquery.js'/>"></script>                  <script type="text/javascript" src="<spring:url value='/assets/kendoui/js/kendo.all.min.js'/>"></script>                  </head>                    <body>                      <spring:url value="/secure/assets/list" var="transportReadUrl" />                        <kendo:grid name="grid" selectable="single" pageable="true" groupable="true" sortable="true" filterable="true">                          <kendo:grid-columns>                              <kendo:grid-column title="Name" field="name" />                              <kendo:grid-column title="Quantity" field="quantity" />                              <kendo:grid-column title="Dimensions" field="dimensions" />                          </kendo:grid-columns>                          <kendo:dataSource pageSize="5" serverPaging="true">                              <kendo:dataSource-schema data="assets" total="total">                                  <kendo:dataSource-schema-model>                                      <kendo:dataSource-schema-model-fields>                                          <kendo:dataSource-schema-model-field name="name" type="string" />                                          <kendo:dataSource-schema-model-field name="quantity" type="number" />                                          <kendo:dataSource-schema-model-field name="dimensions" type="number" />                                      </kendo:dataSource-schema-model-fields>                                  </kendo:dataSource-schema-model>                              </kendo:dataSource-schema>                              <kendo:dataSource-transport>                                  <kendo:dataSource-transport-read    contentType="application/json" type="POST" url="${transportReadUrl}">                                </kendo:dataSource-transport-read>                                   <kendo:dataSource-transport-parameterMap>                                          <script>                                              function parameterMap(data, type) {                                                  if(type =="read")                                                  {                                                     return JSON.stringify(data);                                                  }                                                  return JSON.stringify(data);                                              }                                          </script>                                      </kendo:dataSource-transport-parameterMap>                              </kendo:dataSource-transport>                          </kendo:dataSource>                      </kendo:grid>                  </body>                  </html> 








 @RequestMapping(value = "/list", method = RequestMethod.POST,headers="Accept=application/json",consumes = MediaType.APPLICATION_JSON_VALUE, produces = "application/json; charset=UTF-8")      @ResponseBody     public  String listAssetsJSON(@RequestBody DataSourceRequest request)         {              System.out.println("ttttt ");              System.out.println("ttttt "+request.getPage());      System.out.println("ttttt "+request.getPage()+" "+request.getPageSize()); 




On datasourcerequest i keep getting
org.springframework.web.HttpMediaTypeNotSupportedException: Content type
'application/json;charset=UTF-8' not supported

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 02 Jan 2015, 11:21 AM
Hello,

We found a few questions that sound similar. One of the causes is a DTO which can't be serialised - missing default constructor or similar.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
zain
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or