Skip to content

Document the need for consistent access to form data through ServerWebExchange [SPR-17291] #21824

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
spring-projects-issues opened this issue Sep 19, 2018 · 3 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: task A general task
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 19, 2018

Spencer Gibb opened SPR-17291 and commented

Either @RequestBody or other subscription (such as spring-cloud-gateway)

 

See also spring-projects/spring-boot#14520


Affects: 5.0.9

Reference URL: spring-cloud/spring-cloud-gateway#541

Issue Links:

Referenced from: commits 9630445

0 votes, 5 watchers

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 19, 2018

Spencer Gibb commented

Also related #21094

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

I've turned it into an improvement, since it is by design that the filter reads the body. Typically that wouldn't be an issue with annotated controllers nor functional endpoints where form data is read via ServerWebExchange#getFormData which is cached. However, it's clear there are use cases like Spring Cloud Gateway where the raw request body might need to be read.

@spring-projects-issues
Copy link
Collaborator Author

Rossen Stoyanchev commented

After further thought, I've decided to leave this as is, and document the need for consistent access to the parsed form data through the ServerWebExchange. The alternative of caching both the raw and the parsed content is not ideal.

For the much less common case where the raw form data might still be needed, the FormHttpMessageWriter could be used to do encode the parsed form data back into serialized form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants