Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 162 for okHttpClient (0.09 sec)

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

     */
    package okhttp3.recipes;
    
    import java.io.IOException;
    import okhttp3.Credentials;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;
    
    public final class Authenticate {
      private final OkHttpClient client;
    
      public Authenticate() {
        client = new OkHttpClient.Builder()
            .authenticator((route, response) -> {
              if (response.request().header("Authorization") != null) {
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Thu Aug 12 07:26:27 UTC 2021
    - 1.9K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/HttpsServer.java

        HandshakeCertificates clientCertificates = new HandshakeCertificates.Builder()
            .addTrustedCertificate(localhostCertificate.certificate())
            .build();
        OkHttpClient client = new OkHttpClient.Builder()
            .sslSocketFactory(clientCertificates.sslSocketFactory(), clientCertificates.trustManager())
            .build();
    
        Call call = client.newCall(new Request.Builder()
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jan 02 14:04:37 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  3. samples/guide/src/main/java/okhttp3/recipes/PreemptiveAuth.java

    import java.io.IOException;
    import okhttp3.Credentials;
    import okhttp3.Interceptor;
    import okhttp3.OkHttpClient;
    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"))
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Nov 05 07:46:46 UTC 2018
    - 2.1K bytes
    - Viewed (0)
  4. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceFactoryTest.java

    public class EventSourceFactoryTest {
    
      @StartStop
      private final MockWebServer server = new MockWebServer();
    
      @Test
      public void testEventSourceFactory() throws Exception {
        OkHttpClient client = new OkHttpClient();
        EventSource.Factory factory = EventSource.Factory.create(client);
        server.enqueue(
          new MockResponse.Builder()
            .body("data: hello\n\n")
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 11:47:47 UTC 2025
    - 2.8K bytes
    - Viewed (0)
  5. samples/guide/src/main/java/okhttp3/recipes/kt/AsynchronousGet.kt

     * limitations under the License.
     */
    package okhttp3.recipes.kt
    
    import java.io.IOException
    import okhttp3.Call
    import okhttp3.Callback
    import okhttp3.OkHttpClient
    import okhttp3.Request
    import okhttp3.Response
    
    class AsynchronousGet {
      private val client = OkHttpClient()
    
      fun run() {
        val request =
          Request
            .Builder()
            .url("http://publicobject.com/helloworld.txt")
            .build()
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 1.6K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/PostStreamingWithPipe.java

    import okhttp3.MediaType;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.RequestBody;
    import okhttp3.Response;
    import okio.BufferedSink;
    import okio.Okio;
    import okio.Pipe;
    
    public final class PostStreamingWithPipe {
      public static final MediaType MEDIA_TYPE_MARKDOWN
          = MediaType.get("text/x-markdown; charset=utf-8");
    
      private final OkHttpClient client = new OkHttpClient();
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Fri Jul 06 03:18:15 UTC 2018
    - 3.1K bytes
    - Viewed (0)
  7. okhttp-sse/src/main/kotlin/okhttp3/sse/EventSources.kt

    import okhttp3.Call
    import okhttp3.OkHttpClient
    import okhttp3.Response
    import okhttp3.sse.EventSource.Companion.processEventSource
    import okhttp3.sse.EventSource.Factory.Companion.asEventSourceFactory
    
    object EventSources {
      @Deprecated(
        message = "required for binary-compatibility!",
        level = DeprecationLevel.HIDDEN,
      )
      @JvmStatic
      fun createFactory(client: OkHttpClient) = client.asEventSourceFactory()
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat Aug 30 11:47:47 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  8. samples/guide/src/main/java/okhttp3/recipes/kt/DevServer.kt

     * limitations under the License.
     */
    package okhttp3.recipes.kt
    
    import java.io.IOException
    import java.net.HttpURLConnection.HTTP_MOVED_TEMP
    import okhttp3.OkHttpClient
    import okhttp3.Request
    import okhttp3.mockwebserver.MockResponse
    import okhttp3.mockwebserver.MockWebServer
    import okhttp3.tls.HandshakeCertificates
    import okhttp3.tls.internal.TlsUtil
    
    class DevServer {
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 1.9K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/kt/ParseResponseWithMoshi.kt

     */
    package okhttp3.recipes.kt
    
    import com.squareup.moshi.JsonClass
    import com.squareup.moshi.Moshi
    import java.io.IOException
    import okhttp3.OkHttpClient
    import okhttp3.Request
    
    class ParseResponseWithMoshi {
      private val client = OkHttpClient()
      private val moshi = Moshi.Builder().build()
      private val gistJsonAdapter = moshi.adapter(Gist::class.java)
    
      fun run() {
        val request =
          Request
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 1.6K bytes
    - Viewed (0)
  10. okhttp-tls/README.md

    Entrust and Verisign.
    
    This is the behavior you'll get with your OkHttpClient if you don't specifically configure
    `HandshakeCertificates`. Or you can do it explicitly with `addPlatformTrustedCertificates()`:
    
    ```java
    HandshakeCertificates clientCertificates = new HandshakeCertificates.Builder()
        .addPlatformTrustedCertificates()
        .build();
    OkHttpClient client = new OkHttpClient.Builder()
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Mon Jul 07 19:32:33 UTC 2025
    - 9.1K bytes
    - Viewed (0)
Back to top