Skip to content
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

Resteasy-Reactive: Read an manipulate body with ContainerRequestContext in a non-blocking wise #17791

Closed
wernert75 opened this issue Jun 9, 2021 · 5 comments
Labels
area/rest kind/enhancement New feature or request triage/duplicate This issue or pull request already exists

Comments

@wernert75
Copy link

Description

I try to read the body of a REST-Request within a ContainerRequestFilter.

            InputStream is = context.getEntityStream();
            byte[] data = is.readAllBytes();
            String body = new String(data, StandardCharsets.UTF_8);

Unfortunately this blocks the io-thread.

I think it's really useful in an complete reactive approach to access and modify the body in a filter, that is not blocking the io-thread.

@wernert75 wernert75 added the kind/enhancement New feature or request label Jun 9, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 9, 2021

/cc @FroMage, @geoand, @stuartwdouglas

@quarkus-bot quarkus-bot bot added the area/rest label Jun 9, 2021
@stuartwdouglas
Copy link
Member

You need to mark the filter as @Blocking. @FroMage @geoand it looks like ResteasyReactiveContainerRequestFilter does not help here, as it does not appear to have support for async reads in the API that we expose?

@geoand
Copy link
Contributor

geoand commented Jun 9, 2021

Yeah exactly. That's something we should provide as this is not the first time this has come up

@FroMage
Copy link
Member

FroMage commented Jun 9, 2021

Yeah, we don't have a way to do an async read unless you use the vert.x APIs directly, and also, we don't have a way for filters to set the body to a stream either for further consumption.

@geoand
Copy link
Contributor

geoand commented Aug 4, 2021

I'll close this in favor of #17280 which has more of a discussion

@geoand geoand closed this as completed Aug 4, 2021
@geoand geoand added the triage/duplicate This issue or pull request already exists label Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/enhancement New feature or request triage/duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants