You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/responsebody.adoc
+7
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,13 @@ Kotlin::
37
37
all controller methods. This is the effect of `@RestController`, which is nothing more
38
38
than a meta-annotation marked with `@Controller` and `@ResponseBody`.
39
39
40
+
A `Resource` object can be returned for file content, copying the `InputStream`
41
+
content of the provided resource to the response `OutputStream`. Note that the
42
+
`InputStream` should be lazily retrieved by the `Resource` handle in order to reliably
43
+
close it after it has been copied to the response. If you are using `InputStreamResource`
44
+
for such a purpose, make sure to construct it with an on-demand `InputStreamSource`
45
+
(e.g. through a lambda expression that retrieves the actual `InputStream`).
46
+
40
47
You can use `@ResponseBody` with reactive types.
41
48
See xref:web/webmvc/mvc-ann-async.adoc[Asynchronous Requests] and xref:web/webmvc/mvc-ann-async.adoc#mvc-ann-async-reactive-types[Reactive Types] for more details.
0 commit comments