Skip to content

HttpEntityMethodProcessor does not support HttpEntity/ResponseEntity subclasses [SPR-10207] #14840

@spring-projects-issues

Description

@spring-projects-issues

Shelley J. Baker opened SPR-10207 and commented

The HttpEntityMethodProcessor's supportsReturnType method explicitly looks for ResponseEntity/HttpEntity classes, not whether they are assignable from those classes:

public boolean supportsReturnType(MethodParameter returnType) {
	Class<?> parameterType = returnType.getParameterType();
	return HttpEntity.class.equals(parameterType) || ResponseEntity.class.equals(parameterType);
}

This prevents HttpEntity/ResponseEntity subclasses from being processed. This method should be updated similar to the following, in order to support HTTP entity subclasses:

public boolean supportsReturnType(MethodParameter returnType) {
    Class<?> parameterType = returnType.getParameterType();
    return HttpEntity.class.isAssignableFrom(parameterType);
}

This problem was first described here in #14680.


Affects: 3.1.3

Issue Links:

Referenced from: commits a3e190e, 3a6e7b8

Backported to: 3.1.4

0 votes, 5 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions