<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=egervari" rel="nofollow">Ken Egervari</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-7054?redirect=false" rel="nofollow">SPR-7054</a></strong> and commented</p>
<p dir="auto">I am having a heck of a time doing complex Ajax stuff with Spring MVC 3.0. While I totally appreciate a lot of the advancements, there are a few features that are just "missing".</p>
<p dir="auto">The one thing I am having problems with is <code class="notranslate">@RequestBody</code>. It seems that Spring is handling JSON mappings to Strings, ints, longs and other primitive types just fine. Unfortunately... and this is extremely disappointing... Spring does not also use the property editors.</p>
<p dir="auto">So, in its current state, we can create an object with "long myDomainObjectId" but not "MyDomainObject myDomainObject" and have Spring do the mapping for us. Instead, Spring throws back:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ()."><pre class="notranslate"><code class="notranslate">The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ().
</code></pre></div>
<p dir="auto">In Firebug, it just says, "Unsupported Mime type". And before you say anything, I am sending "application/json" with the charset set to utf8 (as many examples say to do, although I've tried it all kinds of ways). I have used every option conceivable in jQuery - this is a problem with Spring.</p>
<p dir="auto">So guys... are we supposed to do all this mapping ourselves? What if we are sending json data that is nested 2 or 3 times - do we manually traverse the "long[] ids" arrays and fetch everything ourselves? What if we have to do this for 100 controllers actions? My god, that is insane.</p>
<hr>
<p dir="auto">Now, I have tried to use GET instead of POST, even though POST is what I want. However, this causes all kinds of other problems with jQuery. For example,</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{&quot;activeQuestion&quot;:&quot;551&quot;,&quot;categories&quot;:[&quot;129&quot;,&quot;129&quot;,&quot;128&quot;],&quot;categoryAnswers&quot;:[&quot;487&quot;,&quot;489&quot;,&quot;488&quot;]}"><pre class="notranslate"><code class="notranslate">{"activeQuestion":"551","categories":["129","129","128"],"categoryAnswers":["487","489","488"]}
</code></pre></div>
<p dir="auto">You would think that this would transfer fine... but it doesn't. jQuery creates these GET Request headers:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="?activeQuestion=551&amp;
categories[]=129&amp;
categories[]=128&amp;
categoryAnswers[]=487&amp;
categoryAnswers[]=488"><pre class="notranslate"><code class="notranslate">?activeQuestion=551&amp;
categories[]=129&amp;
categories[]=128&amp;
categoryAnswers[]=487&amp;
categoryAnswers[]=488
</code></pre></div>
<p dir="auto">As you can see, it doesn't put the indexes for the array notation, and it also chops out a duplicate. The only way to fix this via jQuery is to wrap the numbers in their own objects. Man, talk about bloated! That means we have to create bloated DTO objects that mirror the JSON data... and then convert to the "REAL" domain model afterward.</p>
<p dir="auto">While this GET approach is slightly better because at least Spring does in fact do use the property editors... we still have to create a bunch of dummy objects that pollute the system for every controller action. Not to mention, we have to use GET for everything - even things that should be POST.</p>
<hr>
<p dir="auto">I will admit, maybe I don't know enough about Spring 3.0's new features and there is solutions around this stuff... but that only emphasizes the failure of your documentation then... as well as the failure in your "Spring 3.0 Simplications for Ajax" article, which doesn't talk about doing anything complicated.</p>
<p dir="auto">And I'm just getting started... but it seems all Ajax examples in every framework - JavaScript or otherwise - just show really simple, easy examples. I guess they know their frameworks aren't up to snuff when it comes to something complex - like "a list of numbers".</p>
<p dir="auto">Guys, why can't we just get this stuff to "Work"? :(</p>
<p dir="auto">Thanks for listening. I apologize for venting, but I have went from YUI 3.0 -&gt; jQuery... and now because of jQuery's poor API design as well as it's crappy .ajax implementation, I may have to try out Dojo to see if it's any better. YUI 3.0 is bloated beyond belief, it's ajax requests are 10x slower than jQuery's... and ultimately, the new sandbox model is terrible for trying to wrap YUI in an application core framework to make sure it doesn't get exposed to higher levels of the application-specific JavaScript.</p>
<p dir="auto">It would seem that nobody has gotten this ajax stuff to work seamlessly. Yuck. No wonder I don't want to touch it. Now I have to.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0.2</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398102154" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/11397" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/11397/hovercard" href="https://github.com/spring-projects/spring-framework/issues/11397">#11397</a> MappingJacksonHttpMessageConverter's ObjectMapper does not use ConversionService when binding JSON to JavaBean properties (<em><strong>"duplicates"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398160369" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/15394" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/15394/hovercard" href="https://github.com/spring-projects/spring-framework/issues/15394">#15394</a> Spring dependency injection for Jackson serializers</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398171298" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/16758" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/16758/hovercard" href="https://github.com/spring-projects/spring-framework/issues/16758">#16758</a>  Support jackson mix-in classes in Jackson2ObjectMapperFactoryBean</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398172849" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/16918" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/16918/hovercard" href="https://github.com/spring-projects/spring-framework/issues/16918">#16918</a> Add serializerByType() deserializerByType() and mixIn() to Jackson2ObjectMapperBuilder</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398102241" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/11406" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/11406/hovercard" href="https://github.com/spring-projects/spring-framework/issues/11406">#11406</a> Spring MVC Binding Lifecycle differs between <code class="notranslate">@RequestBody</code> arguments and plain JavaBean arguments</li>
</ul>
<p dir="auto">7 votes, 12 watchers</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=paul4christ79" rel="nofollow">Paul Benedict</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-3181?redirect=false" rel="nofollow">SPR-3181</a></strong> and commented</p>
<p dir="auto">I have a custom instance of LocalizationContext and I'd like to use JstlUtils.exposeLocalizationContext to set it. However, the method accepts only a MessageSource. Let's refactor out this method:</p>
<p dir="auto">public static void exposeLocalizationContext(HttpServletRequest request, LocalizationContext jstlContext);</p>
<p dir="auto">Is this request in time for 2.0.3?</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.2</p>