Sample code for 30+ languages & platforms
Java

Example: Http.GetRequestHeader method

Demonstrates the GetRequestHeader method.

Chilkat Java Downloads

Java
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();

    String hdr1 = "X-CSRF-Token";
    String hdr2 = "X-Example";

    http.SetRequestHeader(hdr1,"Fetch");
    http.SetRequestHeader(hdr2,"123ABC");

    System.out.println(hdr1 + ": " + http.getRequestHeader(hdr1));
    System.out.println(hdr2 + ": " + http.getRequestHeader(hdr2));

    //  Output:

    //  X-CSRF-Token: Fetch
    //  X-Example: 123ABC
  }
}