title: @ResourceMapping that accepts JSON from Ajax request
body: <p>I'm searching how I can interprete a JSON parameter in my @ResourceMapping in Spring Portlet MVC. When I add @RequestBody, I got the message: @RequestBody is not supported... Really stuck on this one. </p>
  
  <p>I have this:</p>
  
  <p>View side: </p>
  
  <pre><code>&lt;portlet:resourceURL var="getTest" id="ajaxTest" &gt;&lt;/portlet:resourceURL&gt;
  
      &lt;p&gt;
          &lt;button onClick="executeAjaxTest();"&gt;Klik mij!&lt;/button&gt;
          &lt;button onClick="$('#ajaxResponse').html('');"&gt;Klik mij!&lt;/button&gt;
      &lt;/p&gt;
      &lt;p&gt;
          &lt;h3&gt;Hieronder het antwoord:&lt;/h3&gt;
          &lt;h4 id="ajaxResponse"&gt;&lt;/h4&gt;
      &lt;/p&gt;
  
      &lt;script&gt;
          function executeAjaxTest() {
  
              var jsonObj = {
                      user: "Korneel",
                      password: "testpassword",
                      type: {
                          testParam: "test",
                      }
                  }
  
              console.debug(JSON.stringify(jsonObj));
              $.ajax({
                  dataType: "json",
                  contentType:"application/json",
                  mimeType: 'application/json',
                  url:"&lt;%=getTest%&gt;",
                  data:JSON.stringify(jsonObj),
                  success : function(data) {
                      $("#ajaxResponse").html(data['testString']);
                  }
              });
  
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>Controller side: </p>
  
  <pre><code>@ResourceMapping(value="ajaxTest")
      @ResponseBody
      public void ajaxTestMethod(ResourceRequest request, ResourceResponse response) throws IOException, ParseException {
  
          LOGGER.debug("ajax method");
  
          JSONObject json = JSONFactoryUtil.createJSONObject();
          json.put("testString", "Ik ben succesvol verstuurd geweest!");
          response.getWriter().write(json.toString());
  }
  </code></pre>
  
  <p>How can I use the spring magic to auto map this JSON data to my own model? 
  Note: It's Spring Portlet MVC, not regular Spring MVC..</p>