Search Options

Results per page
Sort
Preferred Languages
Advance

Results 631 - 640 of 924 for builder2 (0.1 sec)

  1. samples/guide/src/main/java/okhttp3/guide/GetExample.java

    import okhttp3.Request;
    import okhttp3.Response;
    
    public class GetExample {
      final 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();
        }
      }
    
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Fri Apr 05 03:30:42 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  2. samples/guide/src/main/java/okhttp3/recipes/kt/PostForm.kt

    import okhttp3.HttpUrl.Companion.toHttpUrl
    import okhttp3.OkHttpClient
    import okhttp3.Request
    
    class PostForm {
      private val client = OkHttpClient()
    
      fun run() {
        val formBody =
          FormBody.Builder()
            .add("search", "Jurassic Park")
            .build()
        val request =
          Request(
            url = "https://en.wikipedia.org/w/index.php".toHttpUrl(),
            body = formBody,
          )
    
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  3. samples/guide/src/main/java/okhttp3/recipes/kt/SynchronousGet.kt

    import java.io.IOException
    import okhttp3.OkHttpClient
    import okhttp3.Request
    
    class SynchronousGet {
      private val client = OkHttpClient()
    
      fun run() {
        val request =
          Request.Builder()
            .url("https://publicobject.com/helloworld.txt")
            .build()
    
        client.newCall(request).execute().use { response ->
          if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/base/EnumsTest.java

       */
      // TODO(b/65488446): Make this a public API.
      @J2ktIncompatible
      @GwtIncompatible
      private static ImmutableList<URL> parseJavaClassPath() {
        ImmutableList.Builder<URL> urls = ImmutableList.builder();
        for (String entry : Splitter.on(PATH_SEPARATOR.value()).split(JAVA_CLASS_PATH.value())) {
          try {
            try {
              urls.add(new File(entry).toURI().toURL());
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed May 29 16:29:37 UTC 2024
    - 8.7K bytes
    - Viewed (0)
  5. samples/guide/src/main/java/okhttp3/recipes/kt/PerCallSettings.kt

    import java.util.concurrent.TimeUnit
    import okhttp3.OkHttpClient
    import okhttp3.Request
    
    class PerCallSettings {
      private val client = OkHttpClient()
    
      fun run() {
        val request =
          Request.Builder()
            .url("http://httpbin.org/delay/1") // This URL is served with a 1 second delay.
            .build()
    
        // Copy to customize OkHttp for this request.
        val client1 =
          client.newBuilder()
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  6. samples/guide/src/main/java/okhttp3/recipes/kt/PostPath.kt

      private val fileSystem = FakeFileSystem()
      val path = "test.json".toPath()
    
      fun run() {
        fileSystem.write(path) {
          writeUtf8("{}")
        }
    
        val request =
          Request.Builder()
            .url("https://httpbin.org/anything")
            .put(path.asRequestBody(fileSystem, MEDIA_TYPE_JSON))
            .build()
    
        client.newCall(request).execute().use { response ->
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/PostString.java

            + "Releases\n"
            + "--------\n"
            + "\n"
            + " * _1.0_ May 6, 2013\n"
            + " * _1.1_ June 15, 2013\n"
            + " * _1.2_ August 11, 2013\n";
    
        Request request = new Request.Builder()
            .url("https://api.github.com/markdown/raw")
            .post(RequestBody.create(postBody, MEDIA_TYPE_MARKDOWN))
            .build();
    
        try (Response response = client.newCall(request).execute()) {
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat May 25 18:02:55 UTC 2019
    - 1.7K bytes
    - Viewed (0)
  8. regression-test/src/androidTest/java/okhttp/regression/compare/OkHttpClientTest.java

     */
    @RunWith(AndroidJUnit4.class)
    public class OkHttpClientTest {
      @Test public void get() throws IOException {
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
            .url("https://google.com/robots.txt")
            .build();
        try (Response response = client.newCall(request).execute()) {
          assertEquals(200, response.code());
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sat Nov 14 17:38:22 UTC 2020
    - 1.4K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/kt/AsynchronousGet.kt

    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()
    
        client.newCall(request).enqueue(
          object : Callback {
            override fun onFailure(
              call: Call,
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Mon Jan 08 01:13:22 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/AccessHeaders.java

    import okhttp3.Request;
    import okhttp3.Response;
    
    public final class AccessHeaders {
      private final OkHttpClient client = new OkHttpClient();
    
      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("https://api.github.com/repos/square/okhttp/issues")
            .header("User-Agent", "OkHttp Headers.java")
            .addHeader("Accept", "application/json; q=0.5")
    Registered: Fri Nov 01 11:42:11 UTC 2024
    - Last Modified: Sun May 22 01:29:42 UTC 2016
    - 1.6K bytes
    - Viewed (0)
Back to top