Search Options

Results per page
Sort
Preferred Languages
Advance

Results 71 - 80 of 152 for New (0.11 sec)

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

    public final class PrintEventsNonConcurrent {
      private final OkHttpClient client = new OkHttpClient.Builder()
          .eventListener(new PrintingEventListener())
          .build();
    
      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("https://publicobject.com/helloworld.txt")
            .build();
    
        System.out.println("REQUEST 1 (new connection)");
        try (Response response = client.newCall(request).execute()) {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Feb 16 23:20:49 GMT 2020
    - 5.3K bytes
    - Viewed (0)
  2. okhttp/src/main/kotlin/okhttp3/MultipartReader.kt

          var whitespace = false
          afterBoundaryLoop@while (true) {
            when (source.select(afterBoundaryOptions)) {
              0 -> {
                // "\r\n": We've found a new part.
                partCount++
                break@afterBoundaryLoop
              }
    
              1 -> {
                // "--": No more parts.
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 7.1K bytes
    - Viewed (0)
  3. samples/guide/src/main/java/okhttp3/recipes/WebSocketEcho.java

    import okhttp3.WebSocketListener;
    import okio.ByteString;
    
    public final class WebSocketEcho extends WebSocketListener {
      private void run() {
        OkHttpClient client = new OkHttpClient.Builder()
            .readTimeout(0,  TimeUnit.MILLISECONDS)
            .build();
    
        Request request = new Request.Builder()
            .url("ws://echo.websocket.org")
            .build();
        client.newWebSocket(request, this);
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 04 11:40:21 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  4. regression-test/src/androidTest/java/okhttp/regression/LetsEncryptTest.java

                  "-----END CERTIFICATE-----";
    
          CertificateFactory cf = CertificateFactory.getInstance("X.509");
          Certificate isgCertificate = cf.generateCertificate(new ByteArrayInputStream(isgCert.getBytes("UTF-8")));
    
          HandshakeCertificates certificates = new HandshakeCertificates.Builder()
                  .addTrustedCertificate((X509Certificate) isgCertificate)
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Tue Nov 17 07:40:31 GMT 2020
    - 6.1K bytes
    - Viewed (0)
  5. okhttp/src/main/kotlin/okhttp3/internal/cache/CacheInterceptor.kt

              cache.remove(networkRequest)
            } catch (_: IOException) {
              // The cache cannot be written.
            }
          }
        }
    
        return response
      }
    
      /**
       * Returns a new source that writes bytes to [cacheRequest] as they are read by the source
       * consumer. This is careful to discard bytes left over when the stream is closed; otherwise we
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Mar 22 07:09:21 GMT 2024
    - 10.2K bytes
    - Viewed (0)
  6. okhttp/src/main/kotlin/okhttp3/HttpUrl.kt

     * "/static/images/" before serving the corresponding assets from the filesystem.
     *
     * ```java
     * String attack = "http://example.com/static/images/../../../../../etc/passwd";
     * System.out.println(new URL(attack).getPath());
     * System.out.println(new URI(attack).getPath());
     * System.out.println(HttpUrl.parse(attack).encodedPath());
     * ```
     *
     * By canonicalizing the input paths, they are complicit in directory traversal attacks. Code that
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Tue Jan 09 12:33:05 GMT 2024
    - 63.5K bytes
    - Viewed (1)
  7. samples/guide/src/main/java/okhttp3/recipes/CancelCall.java

    import okhttp3.Response;
    
    public class CancelCall {
      private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
      private final OkHttpClient client = new OkHttpClient();
    
      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("http://httpbin.org/delay/2") // This URL is served with a 2 second delay.
            .build();
    
        final long startNanos = System.nanoTime();
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 2.1K bytes
    - Viewed (0)
  8. okhttp/src/main/kotlin/okhttp3/OkHttpClient.kt

     * for each request wastes resources on idle pools.
     *
     * Use `new OkHttpClient()` to create a shared instance with the default settings:
     *
     * ```java
     * // The singleton HTTP client.
     * public final OkHttpClient client = new OkHttpClient();
     * ```
     *
     * Or use `new OkHttpClient.Builder()` to create a shared instance with custom settings:
     *
     * ```java
     * // The singleton HTTP client.
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 06 04:21:33 GMT 2024
    - 52K bytes
    - Viewed (0)
  9. okhttp/src/main/kotlin/okhttp3/RequestBody.kt

            }
          }
        }
    
        /** Returns a new request body that transmits this. */
        @JvmOverloads
        @JvmStatic
        @JvmName("create")
        fun ByteArray.toRequestBody(
          contentType: MediaType? = null,
          offset: Int = 0,
          byteCount: Int = size,
        ): RequestBody = commonToRequestBody(contentType, offset, byteCount)
    
        /** Returns a new request body that transmits the content of this. */
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Jan 25 14:41:37 GMT 2024
    - 9.6K bytes
    - Viewed (0)
  10. README.md

    
    Get a URL
    ---------
    
    This program downloads a URL and prints its contents as a string. [Full source][get_example].
    
    ```java
    OkHttpClient client = new OkHttpClient();
    
    String run(String url) throws IOException {
      Request request = new Request.Builder()
          .url(url)
          .build();
    
      try (Response response = client.newCall(request).execute()) {
        return response.body().string();
      }
    }
    ```
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Dec 20 23:27:07 GMT 2023
    - 6.2K bytes
    - Viewed (0)
Back to top