Created
December 19, 2013 14:46
-
-
Save nraychaudhuri/8040197 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
| //instead of using WS.url("http://www.google.com") use new CustomRequestHeader(url) | |
| class CustomRequestHolder extends WSRequestHolder { | |
| public CustomRequestHolder(String url) { super(url); } | |
| @Override | |
| public Promise<Response> execute(String method) { | |
| WSRequest req = new WSRequest(method).setUrl(getUrl()) | |
| .setHeaders(getHeaders()) | |
| .setQueryParameters(new FluentStringsMap(getQueryParameters())) | |
| .setVirtualHost("some virtual host"); | |
| try { | |
| Method privateMethod = WSRequestHolder.class.getDeclaredMethod("execute", play.libs.WS.WSRequest.class); | |
| privateMethod.setAccessible(true); | |
| return (Promise<Response>) privateMethod.invoke(this, req); | |
| } catch (Exception e) { | |
| throw new RuntimeException(e); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment