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

Grid dataSource-transport returns 406 not acceptable according to the request “accept” headers

17 Answers 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pranouthi
Top achievements
Rank 1
Pranouthi asked on 29 Jul 2015, 02:53 PM

Hi,

I'm trying to fetch the records to grid using <kendo:dataSource-transport> and i get 406 error i'm setting the contentType="application/json", not sure what else i'm missing.l pls suggest. I followed the same process as given in spring demo.

My Jsp:

 <%@taglib prefix="kendo" uri="http://www.kendoui.com/jsp/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<c:url value="/retrieveCandidateList/update" var="updateUrl" />
<c:url value="/retrieveCandidateList" var="readUrl" />

<form:form method="post" action="retrieveCandidateList.html">

<kendo:grid name="grid" dataBound="gridDataBound">        
        <kendo:grid-editable mode="inline" confirmation="Are you sure you want to remove this item?"></kendo:grid-editable>
        <kendo:grid-columns>
            <kendo:grid-column title="Row Number" field="rowNum" width= "100px" />                    
            <kendo:grid-column title="Work Request Seq" field="wrkRqstSeq" width="130px"/>
            <kendo:grid-column title="Test Package Id" field="tstPkgId" width="230px" />

    <kendo:grid-column title="&nbsp;" width="180px">
                <kendo:grid-column-command>
                    <kendo:grid-column-commandItem name="edit" />
                    <kendo:grid-column-commandItem name="destroy" />
                </kendo:grid-column-command>
        </kendo:grid-column>
        </kendo:grid-columns>
        <kendo:dataSource>                
            <kendo:dataSource-schema>    
                <kendo:dataSource-schema-model id="wrkRqstSeq">
                    <kendo:dataSource-schema-model-fields>
                        <kendo:dataSource-schema-model-field name="rowNum" type="string" editable="false" />                        
                        <kendo:dataSource-schema-model-field name="wrkRqstSeq" type="string" editable="false" />
                        <kendo:dataSource-schema-model-field name="tstPkgId" type="string" editable="false" />

</kendo:dataSource-schema-model-fields>
                </kendo:dataSource-schema-model>
            </kendo:dataSource-schema>
            <kendo:dataSource-transport>    
                <kendo:dataSource-transport-read url="${readUrl}" dataType="json" type="POST" contentType="application/json" />
                <kendo:dataSource-transport-update url="${updateUrl}" dataType="json" type="POST" contentType="application/json" />                
                <kendo:dataSource-transport-parameterMap>
                    <script>
                        function parameterMap(options,type) {                             
                            return JSON.stringify(options);                            
                        }
                    </script>
                </kendo:dataSource-transport-parameterMap>               
            </kendo:dataSource-transport>    
        </kendo:dataSource>
</kendo:grid>​​​​

My controller:

@Controller
@SessionAttributes("data")
public class ListCandidateController
{
    
    @Autowired
    ListCandidateService listCandidate;
    
    Log logger = LogFactory.getLog(this.getClass());

    @RequestMapping(value = "/retrieveCandidateList", method=RequestMethod.POST)
    public @ResponseBody List<WorkRequest> retrieve(@ModelAttribute("data") WorkRequestdata, BindingResult result, HttpServletResponse response) throws Exception
    {        
        response.setContentType("application/json");
        System.out.println("In controller - read method");
        List<WorkRequest> databaseList = listCandidate.retrieveData(data);
        System.out.println("list size:" +databaseList.size());
        return databaseList;
    }​

 

17 Answers, 1 is accepted

Sort by
0
Pranouthi
Top achievements
Rank 1
answered on 30 Jul 2015, 08:45 PM

I was able to load data in Grid using local data (using http://demos.telerik.com/jsp-ui/grid/local-data-binding). However, i have problem with implementing inline editing with this. Demo for inline editing shows with <kendo:dataSource-transport>. I'm using Spring MVC.

0
T. Tsonev
Telerik team
answered on 31 Jul 2015, 03:09 PM
Hi,

The error code indicates that the server can't satisfy the Accept headers set by the client.
In this case you're likely to see the following headers being sent:
  Accept:text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01
  Accept-Encoding:gzip, deflate, sdch

In the context of Spring MVC this might mean that Jackson is misconfigured. In this case it might refuse to return JSON.

Is the answer on SO relevant for your scenario?

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Pranouthi
Top achievements
Rank 1
answered on 31 Jul 2015, 03:19 PM
I'm seeing these headers.
0
Pranouthi
Top achievements
Rank 1
answered on 31 Jul 2015, 04:42 PM

Here are the jsp's i'm using....and My controller has this method:

    @RequestMapping(value = "/retrieveList")    
    @ResponseBody
    public List<WorkRequest> retrieveCandidate(@ModelAttribute("data") WorkRequest data, BindingResult result) throws Exception
    {            
        System.out.println("In controller - read method");
        List<WorkRequest> databaseList = XXX.retrieveData(data);
        System.out.println("list size:" +databaseList.size());       
        return databaseList;
     }​

I'm using Spring3.2.4 and jackson jars jackson-annotations-2.1.1.jar, jackson-core-2.1.1.jar,jackson-databind-2.1.1.jar, jackson-core-asl-1.9.13.jar, jackson-mapper-asl-1.9.13.jar. Also, my servlet context has

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

<context:annotation-config />
 <mvc:annotation-driven/>
Not sure what else i'm missing here.

0
T. Tsonev
Telerik team
answered on 04 Aug 2015, 02:30 PM
Hello,

Thanks for sharing the headers and all the extra info.

Is the request initiated by submitting the form? I can't quite wrap my head around this, but I'm certain it doesn't make sense to submit the grid as part of the form.

Do you get a request to the service if you don't submit the form?

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Pranouthi
Top achievements
Rank 1
answered on 11 Aug 2015, 08:21 PM

I'm not submitting the grid as part of the form submission. First, i have a jsp page to enter the query param and upon form submission,i get the list from the service method and display that list using grid in jsp.

Also, I tried an other approach using GSON library with this i was able to convert to JSON,but the view is not using the kendo jsp wrapper its just displaying the coverted json string. plz advice if i'm missing anything here.

 

0
T. Tsonev
Telerik team
answered on 14 Aug 2015, 07:11 AM
Hello,

Please accept my apologies for the delayed response.

I see, what you describe makes sense and should work fine.
Can you please share the headers for the request to the actual service (/retrieveList)?

The previous headers were for the request for the actual page and that led to a bit of confusion on my side.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Pranouthi
Top achievements
Rank 1
answered on 01 Sep 2015, 06:15 PM

Please find the request header for the list page

 ​

0
Vladimir Iliev
Telerik team
answered on 03 Sep 2015, 11:01 AM
Hello,

After inspecting the screenshot it appears that the provided request headers are the same as the previous ones. From this point a better way to investigate the issue would be providing runable example where the issue is reproduced - could you please provide it?

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Pranouthi
Top achievements
Rank 1
answered on 17 Sep 2015, 06:51 PM

While i get the runnable example.I've an other question. Will i be able to implement inline editing for grid data populated using local data binding like this

<kendo:dataSource data="${products}" pageSize="20">

<kendo:dataSource-schema><kendo:dataSource-schema-model><kendo:dataSource-schema-model-fields><kendo:dataSource-schema-model-field name="productName" type="string" /><kendo:dataSource-schema-model-field name="unitPrice" type="number" /><kendo:dataSource-schema-model-field name="unitsInStock" type="number" /><kendo:dataSource-schema-model-field name="discontinued" type="boolean" /></kendo:dataSource-schema-model-fields></kendo:dataSource-schema-model></kendo:dataSource-schema></kendo:dataSource>​

0
T. Tsonev
Telerik team
answered on 21 Sep 2015, 03:37 PM
Hi,

I don't see why inline editing won't work for this data source definition.
Feel free to include this in the sample as well.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Pranouthi
Top achievements
Rank 1
answered on 30 Sep 2015, 06:02 PM
Attached is the runnable example of the issue above(inline editing not working).
0
Pranouthi
Top achievements
Rank 1
answered on 30 Sep 2015, 06:12 PM
Attached is the runnable example of the issue above(inline editing not working). Please add the Kendo js and
0
Pranouthi
Top achievements
Rank 1
answered on 30 Sep 2015, 06:27 PM

please add Kendo js , styles to GridSample\WebContent\js and GridSample\WebContent\styles folders as these are removed in the attached zip as the max size for the attachment is 2mb. Also, please include the jars below in the GridSample\WebContent\WEB-INF\lib

jackson-annotations-2.2.2.jar

jackson-databind-2.2.2.jar​

jackson-core-2.2.2.jar

kendo-taglib-2014.3.1411.jar

spring-beans-3.2.4.RELEASE.jar

spring-context-3.2.4.RELEASE.jar

spring-context-support-3.2.4.RELEASE.jar

spring-core-3.2.4.RELEASE.jar

spring-expression-3.2.4.RELEASE.jar

spring-web-3.2.4.RELEASE.jar

spring-webmvc-3.2.4.RELEASE.jar​​​​​​​​​

0
T. Tsonev
Telerik team
answered on 02 Oct 2015, 03:06 PM
Hello,

Sorry, I couldn't quite get the project running. I needed a few more JARs (commons-digester, catalina), but that wasn't enough.
I'll give it another shot on Monday.

Please, feel free to open a support ticket in the meantime.
The file attachment size is 20MB there and you shouldn't have problems attaching the full project there.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Pranouthi
Top achievements
Rank 1
answered on 02 Oct 2015, 03:48 PM

Hi,

I have opened a support ticket(Ticket No: 975680) and attached the full running sample project there.

Thanks

0
T. Tsonev
Telerik team
answered on 06 Oct 2015, 01:42 PM
Hello,

We'll continue the discussion there based on the actual project.

Regards,
T. Tsonev
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
Pranouthi
Top achievements
Rank 1
Answers by
Pranouthi
Top achievements
Rank 1
T. Tsonev
Telerik team
Vladimir Iliev
Telerik team
Share this question
or