Anyone who has experience handling xmlHttpRequests with Spring DispatcherPortlet might like it, tell me what is the best way to do this? As an example, I use the YUI io module and Jackson Object Mapper:
@ResourceMapping(value="stuff")
public void method(ResourceResponse response){
Person person = new Person();
person.setWeight(150);
ObjectMapper mapper = new ObjectMapper();
try{
mapper.writeValue(response.getWriter(), person);
}
...
}
Ajax:
function() {
var A = AUI();
A.io("<portlet:resourceURL id="stuff" />", {
method: 'POST',
data: {
description: 'value'
}
});
}
This one is a problem in which you can vote for the spring-portlet environment to be the same as the common spring -mvc has. What is @ResponseBody, converting data to JSON, etc. AFAIK now needs to be done manually ...
EDITED: solution computed
PLEASE: Take a look at this problem, which is better formulated https://stackoverflow.com/questions/4782971/handling-ajax-requests-with-spring-portlet