title: Spring-portlet POST ajax xmlHttpRequest
body: <p>Could please anybody who has experiences with processing post xmlHttpRequests with Spring DispatcherPortlet, tell me what is the best way to do it ? I'm using YUI io module and Jackson Object Mapper as an example :</p>
  
  <pre><code>@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);
        }
     ...
    }
  </code></pre>
  
  <p>Ajax:</p>
  
  <pre><code>function() {
  
     var A = AUI();
  
     A.io("&lt;portlet:resourceURL id="stuff" /&gt;", {
        method: 'POST',
        data: {
          description: 'value'
        }
     });
       }
  </code></pre>
  
  <p><a href="https://jira.springframework.org/browse/SPR-7344" rel="nofollow noreferrer"><strong>This</strong></a> is the issue where you can vote up that spring-portlet environment will have the same support that common spring-mvc has. Which is @ResponseBody, data conversion to JSON etc. Now AFAIK one has to do it manually...</p>
  
  <p>EDITED: Figured out the solution</p>
  
  <p>PLEASE: Take a look at this issue which is better formulated <a href="https://stackoverflow.com/questions/4782971/handling-ajax-requests-with-spring-portlet">https://stackoverflow.com/questions/4782971/handling-ajax-requests-with-spring-portlet</a></p>