-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed as not planned
Closed as not planned
Copy link
Labels
has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importIssues migrated from JIRA with more than 10 votes at the time of importin: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: enhancementA general enhancementA general enhancement
Description
Phil Webb opened SPR-13433 and commented
As requested on the Spring Boot issue tracker:
spring-projects/spring-boot#3890
—
When processing an HttpRequest
with x-www-form-urlencoded
content, we can use a controller with POJO matching the payload structure.
Example payload: value_first=value1&value_second=value2
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public String handlePost(@ModelAttribute Body body) {
}
POJO:
public class Body {
private String value_first;
private String value_second;
}
The problem is that the variable names must match the field names in the HttpRequest
payload in order to be processed by the controller. There is not way of naming them differently, for example, if I do not want to use underscores in Java variable and method names.
What I would appreciate would be using something like this:
@FormAttribute
private String value1;
Issue Links:
- Provide a way to customize the names of JavaBean properties when they're read and written for data binding purposes [SPR-9242] #13880 Provide a way to customize the names of JavaBean properties when they're read and written for data binding purposes
- Provide support for configuring the bindable properties of a form-backing object using field-level annotations [SPR-7747] #12403 Provide support for configuring the bindable properties of a form-backing object using field-level annotations
- Customizable parameter name when binding an object [SPR-10183] #14816 Customizable parameter name when binding an object ("supersedes")
20 votes, 16 watchers
kdlan, trajano, pine, goa, craone and 53 more
Metadata
Metadata
Assignees
Labels
has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importIssues migrated from JIRA with more than 10 votes at the time of importin: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by anothertype: enhancementA general enhancementA general enhancement