[BLOSSOM-89] Multipart resolver does not implement new methods in Spring 3.1 Created: 08/May/12  Updated: 22/Sep/13  Resolved: 08/Aug/13

Status: Closed
Project: Blossom
Component/s: None
Affects Version/s: 1.2.3, 2.0
Fix Version/s: 3.0

Type: Bug Priority: Neutral
Reporter: Tobias Mattsson Assignee: Tobias Mattsson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

In Spring 3.1 there's a new method on MultipartRequest

	String getMultipartContentType(String paramOrFileName);

and one more on MultipartHttpServletRequest

	HttpHeaders getMultipartHeaders(String paramOrFileName);

These methods needs to be implemented for Spring 3.1 but can't be as long as we support Spring 2.5.

The implementation would be.

    public String getMultipartContentType(String paramOrFileName) {
        MultipartFile file = getFile(paramOrFileName);
        return file != null ? file.getContentType() : null;
    }

    public HttpHeaders getMultipartHeaders(String paramOrFileName) {
        String contentType = getMultipartContentType(paramOrFileName);
        if (contentType != null) {
            HttpHeaders headers = new HttpHeaders();
            headers.add(CONTENT_TYPE, contentType);
            return headers;
        }
        else {
            return null;
        }
    }

Generated at Sun Feb 11 23:30:01 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.