Skip to content

Instantly share code, notes, and snippets.

@AkshayMathur92
Created November 19, 2019 05:59
Show Gist options
  • Save AkshayMathur92/a837aa0aeb40693321d3faa9041aecd9 to your computer and use it in GitHub Desktop.
Save AkshayMathur92/a837aa0aeb40693321d3faa9041aecd9 to your computer and use it in GitHub Desktop.
Demo Class for JerseyClient Memory Leak
@Singleton
public class WebClient {
private final Client client;
@Inject
public WebClient(Client client) {
this.client = client;
}
public Object call(String url){
WebTarget target = client.target(url);
target.register(GZipEncoder.class);
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