Class AdvancedHttpClient

java.lang.Object
sonia.scm.net.ahc.AdvancedHttpClient

public abstract class AdvancedHttpClient extends Object
Advanced client for http operations.The AdvancedHttpClient offers a fluid interface for handling most common http operations. The AdvancedHttpClient can be injected by the default injection mechanism of SCM-Manager.

 

Http GET example:

 AdvancedHttpResponse response = client.get("https://scm-manager.org")
                                       .decodeGZip(true)
                                       .request();

 System.out.println(response.contentAsString());
 

 

Http POST example:

 AdvancedHttpResponse response = client.post("https://scm-manager.org")
                                       .formContent()
                                       .field("firstname", "Tricia")
                                       .field("lastname", "McMillan")
                                       .build()
                                       .request();

 if (response.isSuccessful()){
   System.out.println("success");
 }
 
Since:
1.46