Skip to content

@RequestHeader and POJO binding #23838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tsarenkotxt opened this issue Oct 20, 2019 · 3 comments
Closed

@RequestHeader and POJO binding #23838

tsarenkotxt opened this issue Oct 20, 2019 · 3 comments
Assignees
Labels
status: invalid An issue that we don't feel is valid

Comments

@tsarenkotxt
Copy link

tsarenkotxt commented Oct 20, 2019

Hi, do you have plans to add support for header binding with POJO?

This issue based on stackoverflow question @RequestHeader not binding in POJO but binding only in variable

IMHO, it would be a useful feature, instead of writing custom and similar HandlerMethodArgumentResolver

Some ideas:
add an annotation for method args - @Header
add an annotation for POJO fields - @HeaderParam
add support for validation - @Valid
add support for immutable POJO

Thanks

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 20, 2019
@lutongzero
Copy link

related: #23618

@rstoyanchev
Copy link
Contributor

Based on the SO question, you don't need a custom resolver. Just register a Converter. All method arguments sourced from String-based request values (e.g. @RequestHeader, @CookieValue, @PathVariable, etc) pass through to type conversion from String to the target type.

Support for such annotations on fields is something different.

@rstoyanchev rstoyanchev added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 9, 2019
@rstoyanchev rstoyanchev self-assigned this Dec 9, 2019
@bankelal
Copy link

bankelal commented Oct 29, 2020

@rstoyanchev - could you please provide with an example that would be most useful for everyone using Converter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

5 participants