![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Android™) Debugging HTTPTo debug a failed HTTP request or an unexpected response, start by gathering more information about the event.
The Chilkat Http class provides several properties to assist in this process.
The most valuable is the
Additionally, the standard
There are other properties for quick and accessible details, such as
// Important: Don't forget to include the call to System.loadLibrary // as shown at the bottom of this code sample. package com.test; import android.app.Activity; import com.chilkatsoft.*; import android.widget.TextView; import android.os.Bundle; public class SimpleActivity extends Activity { private static final String TAG = "Chilkat"; // Called when the activity is first created. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkHttp http = new CkHttp(); // This example demonstrates session logging via the // SessionLogFilename property. It also examines the // contents of the LastErrorText and a few other properties // to see what transpired in a seemingly simple HTTP GET request. http.put_SessionLogFilename("c:/temp/qa_output/httpSessionLog.txt"); // The "http://www.paypal.com" URL was chosen on // purpose to demonstrate the potential complexity // of a seemingly simple HTTP GET request and response. // // In this case, the initial response is a 302 redirect to // "https://www.paypal.com/" because all communication // with PayPal must be over SSL/TLS. The Chilkat HTTP // FollowRedirects property defaults to true, causing the // redirect to be followed automatically. // The request is resent using SSL/TLS and the response // received is a complex one: it is both Gzipped (compressed) // and "chunked". Internally, Chilkat automatically handles // the decompression and the re-composing of the chunked // response to return the simple HTML page that is the result. String html; html = http.quickGetStr("http://www.paypal.com/"); // Looking at the httpSessionLog, we can see the initial // HTTP request, the 302 response, the subsequent // HTTP GET request to follow the redirect, and the final // gzipped/chunked response: // ---- Sending Wed, 20 Aug 2025 11:10:12 GMT ---- // GET / HTTP/1.1 // Host: www.paypal.com // Accept: */* // Accept-Encoding: gzip // // // ---- Received Wed, 20 Aug 2025 11:10:12 GMT ---- // HTTP/1.1 302 Found // Connection: close // Content-Length: 0 // Server: Varnish // Retry-After: 0 // Location: https://www.paypal.com/us/home // Accept-Ranges: bytes // Date: Wed, 20 Aug 2025 11:10:13 GMT // Via: 1.1 varnish // X-Served-By: cache-chi-klot8100033-CHI // X-Cache: HIT // X-Cache-Hits: 0 // Server-Timing: content-encoding;desc="",x-cdn;desc="fastly" // // // ---- Sending Wed, 20 Aug 2025 11:10:12 GMT ---- // GET /us/home HTTP/1.1 // Host: www.paypal.com // Accept: */* // Accept-Encoding: gzip // // // ---- Received Wed, 20 Aug 2025 11:10:12 GMT ---- // HTTP/1.1 200 OK // Connection: keep-alive // x-content-type-options: nosniff // cache-control: max-age=0, no-cache, no-store, must-revalidate // timing-allow-origin: * // ... // ... // content-encoding: gzip // ... // ... // transfer-encoding: chunked // // 2ef4 // ... // ... // ... } static { System.loadLibrary("chilkat"); // Note: If the incorrect library name is passed to System.loadLibrary, // then you will see the following error message at application startup: //"The application <your-application-name> has stopped unexpectedly. Please try again." } } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.