Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 28 for if (0.36 sec)

  1. samples/static-server/src/main/java/okhttp3/sample/SampleServer.java

        return result;
      }
    
      private String contentType(String path) {
        if (path.endsWith(".png")) return "image/png";
        if (path.endsWith(".jpg")) return "image/jpeg";
        if (path.endsWith(".jpeg")) return "image/jpeg";
        if (path.endsWith(".gif")) return "image/gif";
        if (path.endsWith(".html")) return "text/html; charset=utf-8";
        if (path.endsWith(".txt")) return "text/plain; charset=utf-8";
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Jan 02 02:50:44 GMT 2019
    - 4.7K bytes
    - Viewed (0)
  2. samples/slack/src/main/java/okhttp3/slack/SlackApi.java

        @ToJson String urlToJson(HttpUrl httpUrl) {
          return httpUrl.toString();
        }
    
        @FromJson HttpUrl urlFromJson(String urlString) {
          if (urlString.startsWith("wss:")) urlString = "https:" + urlString.substring(4);
          if (urlString.startsWith("ws:")) urlString = "http:" + urlString.substring(3);
          return HttpUrl.get(urlString);
        }
      }
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Jul 06 19:30:55 GMT 2018
    - 4.4K bytes
    - Viewed (1)
  3. samples/guide/src/main/java/okhttp3/recipes/PostStreaming.java

              int x = n / i;
              if (x * i == n) return factor(x) + " × " + i;
            }
            return Integer.toString(n);
          }
        };
    
        Request request = new Request.Builder()
            .url("https://api.github.com/markdown/raw")
            .post(requestBody)
            .build();
    
        try (Response response = client.newCall(request).execute()) {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Jul 06 03:18:15 GMT 2018
    - 2.1K bytes
    - Viewed (0)
  4. samples/guide/src/main/java/okhttp3/recipes/PostFile.java

            .url("https://api.github.com/markdown/raw")
            .post(RequestBody.create(file, 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());
        }
      }
    
      public static void main(String... args) throws Exception {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 1.5K bytes
    - Viewed (0)
  5. samples/guide/src/main/java/okhttp3/recipes/CustomTrust.java

            .addTrustedCertificate(letsEncryptCertificateAuthority)
            .addTrustedCertificate(entrustRootCertificateAuthority)
            .addTrustedCertificate(comodoRsaCertificationAuthority)
            // Uncomment if standard certificates are also required.
            //.addPlatformTrustedCertificates()
            .build();
    
        client = new OkHttpClient.Builder()
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Aug 12 07:26:27 GMT 2021
    - 9.3K bytes
    - Viewed (2)
  6. samples/guide/src/main/java/okhttp3/recipes/CertificatePinning.java

        Request request = new Request.Builder()
            .url("https://publicobject.com/robots.txt")
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          for (Certificate certificate : response.handshake().peerCertificates()) {
            System.out.println(CertificatePinner.pin(certificate));
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Dec 08 21:30:01 GMT 2019
    - 1.7K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/PostMultipart.java

    import okhttp3.MultipartBody;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.RequestBody;
    import okhttp3.Response;
    
    public final class PostMultipart {
      /**
       * The imgur client ID for OkHttp recipes. If you're using imgur for anything other than running
       * these examples, please request your own client ID! https://api.imgur.com/oauth2
       */
      private static final String IMGUR_CLIENT_ID = "9199fdef135c122";
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jun 24 12:59:42 GMT 2019
    - 2.2K bytes
    - Viewed (0)
  8. samples/slack/src/main/java/okhttp3/slack/SlackClient.java

        this.slackApi = slackApi;
      }
    
      /** Shows a browser URL to authorize this app to act as this user. */
      public void requestOauthSession(String scopes, String team) throws Exception {
        if (sessionFactory == null) {
          sessionFactory = new OAuthSessionFactory(slackApi);
          sessionFactory.start();
        }
    
        HttpUrl authorizeUrl = sessionFactory.newAuthorizeUrl(scopes, team, session -> {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 3.4K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/CustomCipherSuites.java

            TrustManagerFactory.getDefaultAlgorithm());
        trustManagerFactory.init((KeyStore) null);
        TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
        if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) {
          throw new IllegalStateException("Unexpected default trust managers:"
              + Arrays.toString(trustManagers));
        }
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Mar 14 21:57:42 GMT 2019
    - 6.5K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/SynchronousGet.java

        Request request = new Request.Builder()
            .url("https://publicobject.com/helloworld.txt")
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          Headers responseHeaders = response.headers();
          for (int i = 0; i < responseHeaders.size(); i++) {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun May 22 01:29:42 GMT 2016
    - 1.5K bytes
    - Viewed (0)
Back to top