Skip to content

Instantly share code, notes, and snippets.

@AkshayMathur92
Last active November 19, 2019 05:53
Show Gist options
  • Save AkshayMathur92/7222df7422c80bc8681b2eb8079e57d8 to your computer and use it in GitHub Desktop.
Save AkshayMathur92/7222df7422c80bc8681b2eb8079e57d8 to your computer and use it in GitHub Desktop.
WebClient
/**
* @author : akshay.mathur
**/
@Singleton
public class WebClient {
private final Client client;
@Inject
public WebClient(Client client) {
this.client = client;
}
public Object get(String url){
WebTarget target = client.target(url);
Invocation.Builder invocationBuilder = target.request(MediaType.TEXT_PLAIN);
Response response = invocationBuilder.get();
return response.getEntity();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment