Skip to content

Refactor HttpMethod from enum to class #27697

Closed
@poutsma

Description

@poutsma

According to the HTTP specification, the HTTP method is not limited to the well known set (GET, HEAD, PUT, POST, etc.), but can also be an "extension-method". Well known extensions include WebDAV, which added methods like LOCK, COPY, and MOVE.

In Spring Framework, HTTP methods are enumerated in HttpMethod. Because this type is an Java enum, Spring framework needs several workarounds, to allow for HTTP methods not in the enum, such as having both HttpRequest::getMethod as well as HttpRequest::getMethodValue.

If we change HttpMethod from enum to class, we no longer need these workarounds. If we make sure that the new class has the same methods that java.lang.Enum exposes, and given that upgrading to 6.0 requires a recompilation anyway, I believe that now is the time to make this long overdue change.

Note that this issue does not include support for non-standard HTTP (i.e. WebDAV) methods in Spring MVC and/or WebFlux.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions