Sample code for 30+ languages & platforms
Java

Example: Http.HasRequestHeader method

Demonstrates the HasRequestHeader 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[])
  {
    CkHttp http = new CkHttp();

    http.SetRequestHeader("X-CSRF-Token","Fetch");

    boolean b = http.HasRequestHeader("X-CSRF-Token");
    if (b == true) {
        System.out.println("X-CSRF-Token: Yes");
        }
    else {
        System.out.println("X-CSRF-Token: No");
        }

    b = http.HasRequestHeader("X-Something");
    if (b == true) {
        System.out.println("X-Something: Yes");
        }
    else {
        System.out.println("X-Something: No");
        }

    //  The Accept and Accept-Encoding headers are default headers automatically added,
    //  unless the application chooses to remove by calling RemoveRequestHeader for each.
    b = http.HasRequestHeader("Accept");
    if (b == true) {
        System.out.println("Accept: Yes");
        }
    else {
        System.out.println("Accept: No");
        }

    //  Output:

    //  X-CSRF-Token: Yes
    //  X-Something: No
    //  Accept: Yes
  }
}