- Notifications
You must be signed in to change notification settings - Fork38.9k
Improve documentaton on controller return values for file downloads#35760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
rstoyanchev left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is a worthwhile improvement to consider, but not how I would address it.
Both Spring MVC and WebFlux listsupported return types. Neither of them mentionsResource explicitly, but that has more to do with the supported codecs (WebFlux) and message converters (WebMvc).
My suggestion is to begin by adding a subsection onResources underCodecs andMessage Converters. Then this can be mentioned as well as referenced from the list of return values forResponseEntity and@ResponseBody.
Let me know if you plan to update the PR along those lines, or if you only update the WebFlux side, we can do the rest.
rstoyanchev commentedNov 18, 2025
We haveMultipart Content for WebFlux and similar for WebMvc that cover uploads. Renaming that to Multipart Uploads, and creating another on Multipart Downloads would be fine. |
verils commentedNov 18, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Initially, the issue I encountered was that I didn't know how to handle content downloads in WebFlux, as there was no clear explanation in the documentation. I did some search online and finally found out that returning As@rstoyanchev pointed out, theReturn Values section is the best place to address this, I'm gonna add a I also used |
rstoyanchev commentedNov 18, 2025
@verils, I don't think we should avoid documenting returning I will say briefly that if the returned ResponseEntity has the content-type set then I would expect it to get used. However, I would also want to know why the content type of the resource isn't the right one to begin with. This is best discussed in a separate issue. |
verils commentedNov 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@rstoyanchev Yes, I agree that. So I'll just deal with the return type list first. |
Signed-off-by: verils <verils@qq.com>
I've updated the documentation to indicate that a ResponseEntity can be returned from a WebFlux controller.
On a separate note, since file uploads and downloads are common requirements in the Spring framework, I believe it would be beneficial to create a dedicated page to guide developers through the process. I'd be happy to create one. What are your thoughts?