我刚开始学习Virgo Web Server.我正在尝试使用Spring MVC应用程序中的Jakcson JSON.在这个阶段,我无法获得GET请求序列化对象.服务器返回"406 Not Acceptable":
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers ().
Run Code Online (Sandbox Code Playgroud)
使用Rome和JAXB2时会出现同样的问题.
这是项目配置文件和代码:
片段pom.xml:
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>com.springsource.org.codehaus.jackson</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>com.springsource.org.codehaus.jackson.mapper</artifactId>
<version>1.0.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
MANIFEST.MF
Manifest-Version: 1.0
Import-Bundle: com.springsource.org.apache.taglibs.standard;version="[
1.1.2,1.3)",com.springsource.org.codehaus.jackson;version="[1.0.0,1.0
.0]",com.springsource.org.codehaus.jackson.mapper;version="[1.0.0,1.0
.0]"
Bundle-Version: 2.3.0
Tool: Bundlor 1.0.0.RELEASE
Bundle-Name: GreenPages Web
Import-Library: org.springframework.spring;version="[3.0, 3.1)"
Bundle-ManifestVersion: 2
Bundle-SymbolicName: greenpages.web
Web-ContextPath: greenpages
Import-Package: javax.servlet.jsp.jstl.core;version="[1.1.2,1.2.0)",ja
vax.sql,org.apache.commons.dbcp,org.eclipse.virgo.web.dm;version="[2.
0.0, 3.0.0)",org.springframework.core.io;version="[3.0.0.RELEASE,3.1.
0)",org.springframework.stereotype;version="[3.0.0.RELEASE,3.1.0)",or
g.springframework.ui;version="[3.0.0.RELEASE,3.1.0)",org.springframew
ork.web.bind.annotation;version="[3.0.0.RELEASE,3.1.0)",org.springfra
mework.web.servlet.mvc.annotation;version="[3.0.0.RELEASE,3.1.0)",org
.springframework.web.servlet.view;version="[3.0.0.RELEASE,3.1.0)"
Run Code Online (Sandbox Code Playgroud)
web.xml中
<?xml …Run Code Online (Sandbox Code Playgroud)