Created
September 29, 2015 12:15
-
-
Save bill-evanson/349004c1490025590dbd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /** | |
| * Like an internal redirect or an proxy. The URL in the browser doesn't | |
| * change. | |
| */ | |
| public Promise<Result> forwardTo(String url) { | |
| Promise<WS.Response> response = WS.url(url).get(); | |
| return response.map(new Function<WS.Response, Result>() { | |
| public Result apply(WS.Response response) { | |
| // Prevent browser from caching pages - this would be an | |
| // security issue | |
| response().setHeader("Cache-control", "no-cache, no-store"); | |
| return ok(response.getBody()).as("text/html"); | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment