Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for addInterceptor (0.2 sec)

  1. samples/guide/src/main/java/okhttp3/recipes/CurrentDateHeader.java

    import okhttp3.Interceptor;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;
    
    public final class CurrentDateHeader {
      private final OkHttpClient client = new OkHttpClient.Builder()
          .addInterceptor(new CurrentDateInterceptor())
          .build();
    
      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("https://publicobject.com/helloworld.txt")
            .build();
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Oct 31 15:32:50 GMT 2018
    - 1.8K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/LoggingInterceptors.java

    public final class LoggingInterceptors {
      private static final Logger logger = Logger.getLogger(LoggingInterceptors.class.getName());
      private final OkHttpClient client = new OkHttpClient.Builder()
          .addInterceptor(new LoggingInterceptor())
          .build();
    
      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("https://publicobject.com/helloworld.txt")
            .build();
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Jan 01 15:55:32 GMT 2016
    - 2K bytes
    - Viewed (0)
  3. samples/guide/src/main/java/okhttp3/recipes/PreemptiveAuth.java

    import okhttp3.Request;
    import okhttp3.Response;
    
    public final class PreemptiveAuth {
      private final OkHttpClient client;
    
      public PreemptiveAuth() {
        client = new OkHttpClient.Builder()
            .addInterceptor(
                new BasicAuthInterceptor("publicobject.com", "jesse", "password1"))
            .build();
      }
    
      public void run() throws Exception {
        Request request = new Request.Builder()
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Nov 05 07:46:46 GMT 2018
    - 2.1K bytes
    - Viewed (0)
  4. samples/guide/src/main/java/okhttp3/recipes/RequestBodyCompression.java

      public static final MediaType MEDIA_TYPE_JSON = MediaType.get("application/json");
    
      private final OkHttpClient client = new OkHttpClient.Builder()
          .addInterceptor(new GzipRequestInterceptor())
          .build();
      private final Moshi moshi = new Moshi.Builder().build();
      private final JsonAdapter<Map<String, String>> mapJsonAdapter = moshi.adapter(
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 3.8K bytes
    - Viewed (0)
Back to top