Created
December 25, 2016 04:56
-
-
Save rocketpages/9980d632b45e08484f33667ef59728ae to your computer and use it in GitHub Desktop.
Async Shopping Cart Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public CompletionStage<Result> index() { | |
Form<CheckoutForm> checkoutForm = formFactory.form(CheckoutForm.class); | |
CompletionStage<Cart> cartFuture = CompletableFuture.supplyAsync(() -> cartService.getCartForUser(), ec.current()); | |
return cartFuture.thenApply(cart -> ok(index.render(cart, checkoutForm))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment