Java
Java
Example: Http.GetLastJsonData method
Demonstrates theGetLastJsonData method.
Chilkat Java Downloads
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
boolean success = false;
CkHttp http = new CkHttp();
CkHttpResponse resp = new CkHttpResponse();
// Only allow TLS 1.2 or better.
http.put_SslProtocol("TLS 1.2 or higher");
success = http.HttpNoBody("GET","https://google.com/",resp);
if (success == false) {
System.out.println(http.lastErrorText());
return;
}
CkJsonObject json = new CkJsonObject();
json.put_EmitCompact(false);
http.GetLastJsonData(json);
System.out.println(json.emit());
// Output as of Chilkat v11.1.0
// Additional information may be added as requested or needed in future versions of Chilkat.
// {
// "tls": {
// "params": {
// "sniHostname": "www.google.com",
// "allowConnectionOnlyIfServerChooses": "TLS 1.2 or higher"
// },
// "negotiatedTlsVersion": "TLS 1.3"
// }
// }
}
}