Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 28 for body (0.17 sec)

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

        response.append(String.format("<html><head><title>%s</title></head><body>", basePath));
        response.append(String.format("<h1>%s</h1>", basePath));
        for (String file : directory.list()) {
          response.append(String.format("<div class='file'><a href='%s'>%s</a></div>",
              basePath + file, file));
        }
        response.append("</body></html>");
    
        return new MockResponse()
            .setStatus("HTTP/1.1 200")
    Java
    - Registered: Fri Apr 26 11:42:10 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

        Call call = httpClient.newCall(request);
        try (Response response = call.execute()) {
          JsonAdapter<OAuthSession> jsonAdapter = moshi.adapter(OAuthSession.class);
          return jsonAdapter.fromJson(response.body().source());
        }
      }
    
      /** See https://api.slack.com/methods/rtm.start. */
      public RtmStartResponse rtmStart(String accessToken) throws IOException {
        HttpUrl url = baseUrl.newBuilder("rtm.start")
    Java
    - Registered: Fri Apr 26 11:42:10 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/PostFile.java

            .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 {
        new PostFile().run();
      }
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 1.5K bytes
    - Viewed (0)
  4. samples/guide/src/main/java/okhttp3/recipes/PostStreaming.java

            .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 {
        new PostStreaming().run();
      }
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Jul 06 03:18:15 GMT 2018
    - 2.1K bytes
    - Viewed (0)
  5. samples/guide/src/main/java/okhttp3/recipes/RequestBodyCompression.java

          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          System.out.println(response.body().string());
        }
      }
    
      public static void main(String... args) throws Exception {
        new RequestBodyCompression().run();
      }
    
      /** This interceptor compresses the HTTP request body. Many webservers can't handle this! */
      static class GzipRequestInterceptor implements Interceptor {
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 3.8K bytes
    - Viewed (0)
  6. samples/simple-client/src/main/java/okhttp3/sample/OkHttpContributors.java

        try (Response response = client.newCall(request).execute()) {
          // Deserialize HTTP response to concrete type.
          ResponseBody body = response.body();
          List<Contributor> contributors = CONTRIBUTORS_JSON_ADAPTER.fromJson(body.source());
    
          // Sort list by the most contributions.
          Collections.sort(contributors, (c1, c2) -> c2.contributions - c1.contributions);
    
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  7. samples/slack/src/main/java/okhttp3/slack/RtmSession.java

        RtmStartResponse rtmStartResponse = slackApi.rtmStart(accessToken);
        webSocket = slackApi.rtm(rtmStartResponse.url, this);
      }
    
      // TODO(jwilson): can I read the response body? Do I have to?
      //                the body from slack is a 0-byte-buffer
      @Override public synchronized void onOpen(WebSocket webSocket, Response response) {
        System.out.println("onOpen: " + response);
      }
    
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Nov 19 20:16:58 GMT 2016
    - 2.4K bytes
    - Viewed (0)
  8. samples/guide/src/main/java/okhttp3/recipes/Progress.java

              return originalResponse.newBuilder()
                  .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                  .build();
            })
            .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 Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 3.9K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/PostStreamingWithPipe.java

        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
          System.out.println(response.body().string());
        }
      }
    
      private void streamPrimesToSinkAsynchronously(final BufferedSink sink) {
        Thread thread = new Thread("writer") {
          @Override public void run() {
            try {
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Jul 06 03:18:15 GMT 2018
    - 3.1K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/guide/GetExample.java

      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();
        }
      }
    
      public static void main(String[] args) throws IOException {
        GetExample example = new GetExample();
        String response = example.run("https://raw.github.com/square/okhttp/master/README.md");
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 1.3K bytes
    - Viewed (0)
Back to top