Closed spring-projects-issues closed 6 years ago
Rossen Stoyanchev commented
Sébastien Deleuze I'm assigning this to you since Content-Disposition
also comes up in multipart requests and you already have #19114 as well as #19108 for the reactive alternative of FormHttpMessageConverter
. Note that HttpHeaders
already has methods for setting the Content-Disposition
header that are used by the form message converter when writing the headers for individual parts.
Sébastien Deleuze commented
Pull request submitted.
Sébastien Deleuze commented
I have updated the PR that now introduces a new HttpHeaders.ContentDisposition
class and a new HttpHeaders#getContentDisposition()
method that allows to retrieve the disposition type and name
, filename
, filename*
and size
parameters.
Sébastien Deleuze commented
I have resolved this issue via this commit.
It introduces a new ContentDisposition
class designed to parse and generate Content-Disposition
header value as defined in RFC 2183. It supports the disposition type and the name
, filename
(or filename*
when encoded according to RFC 5987) and size
parameters.
This new class is usually used thanks to the new getContentDisposition()
and
setContentDisposition(ContentDisposition)
added to HttpHeaders
.
Oliver Drotbohm opened SPR-14408 and commented
The HTTP 1.1 spec defines the
Content-Disposition
header to contain afilename
attribute that servers can use to indicate the name of the file served. Currently, users ofHttpHeaders
manually have to lookup theContent-Disposition
header and then parse the value to extract the filename.It would be cool if the filename was either available directly or
HttpHeaders
allowed to get access to aContentDisposition
object, that provides access to the filename contained in it.Affects: 4.3 GA
Issue Links:
19114 Reactive multipart request support
19757 ResourceHttpMessageConverter should read the Content-Disposition header (if available) to get the file name
19769 StandardMultipartHttpServletRequest cannot decode multipart Content-Disposition header encoded by FormHttpMessageConverter
21104 Overloaded convenience setters on HttpHeaders
Referenced from: commits https://github.com/spring-projects/spring-framework/commit/99a8510ace46af9b05b822e7c65f08aae885ca98