I have a Spring MVC 3/J2EE Project. The jsp rendering controllers are working fine, but the one controller that renders XML for Ajax is not working. I am using JDK 1.6 in RAD 7.5 so JAXB should be on the classpath, and I've even tried adding the latest JAXB jars to the lib file to make sure. I still get a 406 error when I make the call. My DOJO call has handleAs: "xml"
, and I've confirmed that application/xml
is on the Accept
header via FireBug. I have the <mvc:annotation-driven />
line in my spring servlet xml file. I can see the method being invoked and returning without error. I'm not sure what I should try next to debug.
//Country is a class with only primative types which implements Serializable.
public @ResponseBody List<Country> getCountries(){
return addressService.getCountries();
}
function loadData(){
console.log("Before get ...");
dojo.xhrGet({
url:"http://localhost:9080/sample/shared/getCountries.htm",
handleAs:"xml",
load: function(data){
console.log("In load function ...");
try {
for(var i in data){
console.log("key", i, "value", data[i]);
}
}catch (ex){
console.error("Failure in load function: " + ex);
}
console.log("Exiting load function ...");
},
error: function(x){
console.error("Error in ajax ...");
console.error(x);
},
failOk: false
});
console.log("After get ...");
}