OkHttpClient client = new OkHttpClient.Builder() .connectTimeout(55, TimeUnit.MINUTES) // connect timeout .writeTimeout(55, TimeUnit.MINUTES) // write timeout .readTimeout(55, TimeUnit.MINUTES) // read timeout .build(); RequestBody body = RequestBody.create(json, JSON); Request request = new Request.Builder() .url(url) .put(body) .build(); try (Response response = client.newCall(request).execute()) { return response.body().string(); } catch (IOException e) { e.printStackTrace(); }
put("/putMethod", (request, response) -> { try { TimeUnit.MINUTES.sleep(22); } catch (Exception e) { e.printStackTrace(); } return "text"; });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)