Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 36 of 36 for execute (0.15 sec)

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

            .build();
        Request request = new Request.Builder()
            .url("https://en.wikipedia.org/w/index.php")
            .post(formBody)
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          System.out.println(response.body().string());
        }
      }
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun May 22 01:29:42 GMT 2016
    - 1.4K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/CurrentDateHeader.java

      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("https://publicobject.com/helloworld.txt")
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          System.out.println(response.request().header("Date"));
        }
      }
    
      static class CurrentDateInterceptor implements Interceptor {
        @Override public Response intercept(Chain chain) throws IOException {
    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)
  3. samples/guide/src/main/java/okhttp3/recipes/AccessHeaders.java

            .addHeader("Accept", "application/json; q=0.5")
            .addHeader("Accept", "application/vnd.github.v3+json")
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          System.out.println("Server: " + response.header("Server"));
          System.out.println("Date: " + response.header("Date"));
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun May 22 01:29:42 GMT 2016
    - 1.6K bytes
    - Viewed (0)
  4. samples/guide/src/main/java/okhttp3/recipes/Authenticate.java

      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("http://publicobject.com/secrets/hellosecret.txt")
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          System.out.println(response.body().string());
        }
      }
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Aug 12 07:26:27 GMT 2021
    - 1.9K bytes
    - Viewed (0)
  5. samples/guide/src/main/java/okhttp3/recipes/ParseResponseWithMoshi.java

      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("https://api.github.com/gists/c2a7c39532239ff261be")
            .build();
        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          Gist gist = gistJsonAdapter.fromJson(response.body().source());
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun May 22 01:29:42 GMT 2016
    - 1.8K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/PostString.java

            .url("https://api.github.com/markdown/raw")
            .post(RequestBody.create(postBody, MEDIA_TYPE_MARKDOWN))
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          System.out.println(response.body().string());
        }
      }
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 1.7K bytes
    - Viewed (0)
Back to top