With SPSRINGMVC, using Resteasy debugging, the controller request is set as follows:
Java code
- @RequestMapping (value="/list", Method=requestmethod.get,produces=mediatype.application_json_value)
- @ResponseBody
- Public list<edittimeout> List () {
- list<edittimeout> list = Editimpl.selectall ();
- return list;
- }
Request, debug trace list is the return value no problem, but the foreground page reports the following error:
Java code
- Response Status: 406 (not acceptable)
Response Raw return value is as follows, (first half)
XML code
- HTTP GET Http://127.0.0.1:8080/onlineLibrary/rest/system/editTimeout/list
- host:127.0.0.1:8080
- 406 Not acceptable
- Date:sat, 11:01:07 GMT
- server:apache-coyote/1.1
- content-length:1067
- content-type:text/html; charset=utf-8
- <HTML><head><title>apache Tomcat/7.0.34-error Report< /title><style>
Background prompt Error:
Java code
- 2013-08-17 19:< Span class= "number" >01:03,116 debug Org.springframework.web.servlet.dispatcherservlet -last-modified value For [/onlinelibrary/rest/system/edittimeout/list] is: -1
- 2013-08-17 19:< Span class= "number" >01:07,606 debug org.springframework.web.servlet.mvc.method.annotation.exceptionhandlerexceptionresolver -resolving Exception from handler [public java.util.list< Com.online.ol.filter.edittimeout> com.online.ol.filter.edittimeoutcontoller.list ()]: Org.springframework.web.httpmediatypenotacceptableexception: could not find acceptable representation
- 2013-08-17 19:< Span class= "number" >01:07,680 debug Org.springframework.web.servlet.mvc.annotation.responsestatusexceptionresolver -resolving exception from handler [public java.util.list< Com.online.ol.filter.edittimeout> com.online.ol.filter.edittimeoutcontoller.list ()]: Org.springframework.web.httpmediatypenotacceptableexception: could not find acceptable representation
- 2013-08- : $,681 DEBUG Org.springframework.web.servlet.mvc.support.defaulthandlerexceptionresolver-resolving exception from Handler [ Public java.util.list<com.online.ol.filter.edittimeout> com.online.ol.filter.EditTimeoutContoller.list ()]: Org.springframework.web.HttpMediaTypeNotAcceptableException:Could not find acceptable representation
Cause of the cause:
Because the @responsebody is set, it is wrong to convert the object to JSON format, without the jar package for the conversion dependency.
Workaround:
Join the dependent Jar,jackson-core-asl-1.9.12.jar,jackson-mapper-asl-1.9.12.jar problem resolution.
SPRINGMVC Exception 406 (not acceptable) solution