Skip to content

Commit

Permalink
Merge pull request #25191 from geoand/#25189
Browse files Browse the repository at this point in the history
Ensure that RESTEasy Reactive Links works with async return types
  • Loading branch information
geoand authored Apr 28, 2022
2 parents 42b6730 + 3b6136b commit ed30ee1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.resteasy.reactive.links.deployment;

import java.time.Duration;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
Expand All @@ -15,6 +16,7 @@
import io.quarkus.resteasy.reactive.links.InjectRestLinks;
import io.quarkus.resteasy.reactive.links.RestLink;
import io.quarkus.resteasy.reactive.links.RestLinkType;
import io.smallrye.mutiny.Uni;

@Path("/records")
public class TestResource {
Expand All @@ -29,8 +31,8 @@ public class TestResource {
@Produces(MediaType.APPLICATION_JSON)
@RestLink(entityType = TestRecord.class, rel = "list")
@InjectRestLinks
public List<TestRecord> getAll() {
return RECORDS;
public Uni<List<TestRecord>> getAll() {
return Uni.createFrom().item(RECORDS).onItem().delayIt().by(Duration.ofMillis(100));
}

@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public void setRestLinkData(RestLinkData restLinkData) {

@Override
public void handle(ResteasyReactiveRequestContext context) {
context.requireCDIRequestScope();
Response response = context.getResponse().get();
for (Link link : getLinks(response)) {
response.getHeaders().add("Link", link);
Expand Down

0 comments on commit ed30ee1

Please sign in to comment.