You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by bu...@apache.org on 2022/01/09 16:21:10 UTC
svn commit: r1077932 - in /websites/production/tapestry/content: cache/main.pageCache rest-support-page-is-work-in-progress.html
Author: buildbot
Date: Sun Jan 9 16:21:10 2022
New Revision: 1077932
Log:
Production update by buildbot for tapestry
Modified:
websites/production/tapestry/content/cache/main.pageCache
websites/production/tapestry/content/rest-support-page-is-work-in-progress.html
Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/tapestry/content/rest-support-page-is-work-in-progress.html
==============================================================================
--- websites/production/tapestry/content/rest-support-page-is-work-in-progress.html (original)
+++ websites/production/tapestry/content/rest-support-page-is-work-in-progress.html Sun Jan 9 16:21:10 2022
@@ -96,7 +96,17 @@
}
(...)
}</code></pre>
-</div></div><h2 class="auto-cursor-target" id="RESTSupport(pageisworkinprogress)-Readingtherequestbodywith@RequestBody">Reading the request body with <code>@RequestBody</code></h2><p>Many times, specially with POST, PUT and PATCH requests, the data is sent through the request body. To get this data, the event handler method needs to add a parameter with the <code>@RequestBody</code> annotation. It has a single property, <code>allowEmpty</code>, with <code>false</code> as its default value.</p></div>
+</div></div><h2 class="auto-cursor-target" id="RESTSupport(pageisworkinprogress)-Readingtherequestbodywith@RequestBody">Reading the request body with <code>@RequestBody</code></h2><p>Many times, specially with POST, PUT and PATCH requests, the data is sent through the request body. To get this data, the event handler method needs to add a parameter with the <code>@RequestBody</code> annotation. It has a single property, <code>allowEmpty</code>, with <code>false</code> as its default value, which defines whether an empty request body is empty. If not, an exception will be thrown.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre><code class="language-java">@OnEvent(EventConstants.HTTP_PUT)
+Object save(@RequestBody User user) {
+ (...)
+}
+
+@OnEvent(EventConstants.HTTP_PUT)
+Object save(Long id, @RequestBody User user) {
+ (...)
+}</code></pre>
+</div></div><p>The following types are supported out-of-the-box:</p><ul><li><code>String</code></li><li><code>Reader</code></li><li><code>InputStream</code></li><li>Primitive types and their wrapper types</li></ul><p>The actual conversion logic is implemented in the <code>HttpRequestBodyConverter</code> service, which is defined is an ordered configuration of <code>HttpRequestBodyConverter</code> instances. The service calls all contributed instances until one of them returns a non-null value. If none of them returns a non-null value, it falls back to trying to find a coercion, direct or indirect, from <code>HttpServletRequest</code> to the desired type. </p><p></p></div>
</div>
<!-- /// Content End -->
</div>