Upgrade okhttp to 4.9.0
This commit is contained in:
parent
4aef12ceee
commit
a1492927e6
|
@ -41,7 +41,7 @@ public class Fc2UpdateService extends PaginatedScheduledService {
|
|||
return new Task<List<Model>>() {
|
||||
@Override
|
||||
public List<Model> call() throws IOException {
|
||||
RequestBody body = RequestBody.create(null, new byte[0]);
|
||||
RequestBody body = RequestBody.create(new byte[0]);
|
||||
Request req = new Request.Builder()
|
||||
.url(url)
|
||||
.method("POST", body)
|
||||
|
|
|
@ -103,7 +103,7 @@ public class RemoteRecorder implements Recorder {
|
|||
private Optional<String> sendRequest(String action) throws IOException, InvalidKeyException, NoSuchAlgorithmException {
|
||||
String msg = "{\"action\": \"" + action + "\"}";
|
||||
LOG.debug("Sending request to recording server: {}", msg);
|
||||
RequestBody requestBody = RequestBody.create(JSON, msg);
|
||||
RequestBody requestBody = RequestBody.Companion.create(msg, JSON);
|
||||
Request.Builder builder = new Request.Builder().url(getRecordingEndpoint()).post(requestBody);
|
||||
addHmacIfNeeded(msg, builder);
|
||||
Request request = builder.build();
|
||||
|
@ -121,7 +121,7 @@ public class RemoteRecorder implements Recorder {
|
|||
private void sendRequest(String action, Model model) throws IOException, InvalidKeyException, NoSuchAlgorithmException {
|
||||
String payload = modelRequestAdapter.toJson(new ModelRequest(action, model));
|
||||
LOG.debug("Sending request to recording server: {}", payload);
|
||||
RequestBody body = RequestBody.create(JSON, payload);
|
||||
RequestBody body = RequestBody.Companion.create(payload, JSON);
|
||||
Request.Builder builder = new Request.Builder().url(getRecordingEndpoint()).post(body);
|
||||
addHmacIfNeeded(payload, builder);
|
||||
Request request = builder.build();
|
||||
|
@ -148,7 +148,7 @@ public class RemoteRecorder implements Recorder {
|
|||
private void sendRequest(String action, Recording recording, Runnable... onSuccess) throws InvalidKeyException, NoSuchAlgorithmException, IOException {
|
||||
RecordingRequest recReq = new RecordingRequest(action, recording);
|
||||
String msg = recordingRequestAdapter.toJson(recReq);
|
||||
RequestBody body = RequestBody.create(JSON, msg);
|
||||
RequestBody body = RequestBody.Companion.create(msg, JSON);
|
||||
Request.Builder builder = new Request.Builder().url(getRecordingEndpoint()).post(body);
|
||||
addHmacIfNeeded(msg, builder);
|
||||
Request request = builder.build();
|
||||
|
@ -233,7 +233,7 @@ public class RemoteRecorder implements Recorder {
|
|||
private void syncSpace() {
|
||||
try {
|
||||
String msg = "{\"action\": \"space\"}";
|
||||
RequestBody body = RequestBody.create(JSON, msg);
|
||||
RequestBody body = RequestBody.Companion.create(msg, JSON);
|
||||
Request.Builder builder = new Request.Builder().url(getRecordingEndpoint()).post(body);
|
||||
addHmacIfNeeded(msg, builder);
|
||||
Request request = builder.build();
|
||||
|
@ -268,7 +268,7 @@ public class RemoteRecorder implements Recorder {
|
|||
private void syncModels() {
|
||||
try {
|
||||
String msg = "{\"action\": \"list\"}";
|
||||
RequestBody body = RequestBody.create(JSON, msg);
|
||||
RequestBody body = RequestBody.Companion.create(msg, JSON);
|
||||
Request.Builder builder = new Request.Builder().url(getRecordingEndpoint()).post(body);
|
||||
addHmacIfNeeded(msg, builder);
|
||||
Request request = builder.build();
|
||||
|
@ -301,7 +301,7 @@ public class RemoteRecorder implements Recorder {
|
|||
private void syncOnlineModels() {
|
||||
try {
|
||||
String msg = "{\"action\": \"listOnline\"}";
|
||||
RequestBody body = RequestBody.create(JSON, msg);
|
||||
RequestBody body = RequestBody.Companion.create(msg, JSON);
|
||||
Request.Builder builder = new Request.Builder().url(getRecordingEndpoint()).post(body);
|
||||
addHmacIfNeeded(msg, builder);
|
||||
Request request = builder.build();
|
||||
|
@ -333,7 +333,7 @@ public class RemoteRecorder implements Recorder {
|
|||
private void syncRecordings() {
|
||||
try {
|
||||
String msg = "{\"action\": \"recordings\"}";
|
||||
RequestBody body = RequestBody.create(JSON, msg);
|
||||
RequestBody body = RequestBody.Companion.create(msg, JSON);
|
||||
Request.Builder builder = new Request.Builder().url(getRecordingEndpoint()).post(body);
|
||||
addHmacIfNeeded(msg, builder);
|
||||
Request request = builder.build();
|
||||
|
@ -555,7 +555,7 @@ public class RemoteRecorder implements Recorder {
|
|||
RecordingRequest recReq = new RecordingRequest("rerunPostProcessing", recording);
|
||||
String msg = recordingRequestAdapter.toJson(recReq);
|
||||
LOG.debug(msg);
|
||||
RequestBody body = RequestBody.create(JSON, msg);
|
||||
RequestBody body = RequestBody.Companion.create(msg, JSON);
|
||||
Request.Builder builder = new Request.Builder().url(getRecordingEndpoint()).post(body);
|
||||
addHmacIfNeeded(msg, builder);
|
||||
Request request = builder.build();
|
||||
|
|
|
@ -291,7 +291,7 @@ public class CamsodaModel extends AbstractModel {
|
|||
String csrfToken = ((CamsodaHttpClient)site.getHttpClient()).getCsrfToken();
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.post(RequestBody.create(null, ""))
|
||||
.post(RequestBody.create(new byte[0]))
|
||||
.addHeader(REFERER, Camsoda.BASE_URI + '/' + getName())
|
||||
.addHeader(USER_AGENT, Config.getInstance().getSettings().httpUserAgent)
|
||||
.addHeader(ACCEPT, MIMETYPE_APPLICATION_JSON)
|
||||
|
@ -314,7 +314,7 @@ public class CamsodaModel extends AbstractModel {
|
|||
String csrfToken = ((CamsodaHttpClient)site.getHttpClient()).getCsrfToken();
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.post(RequestBody.create(null, ""))
|
||||
.post(RequestBody.create(new byte[0]))
|
||||
.addHeader(REFERER, Camsoda.BASE_URI + '/' + getName())
|
||||
.addHeader(USER_AGENT, Config.getInstance().getSettings().httpUserAgent)
|
||||
.addHeader(ACCEPT, MIMETYPE_APPLICATION_JSON)
|
||||
|
|
|
@ -220,7 +220,7 @@ public class ChaturbateModel extends AbstractModel { // NOSONAR
|
|||
url = getSite().getBaseUrl() + "/follow/unfollow/" + getName() + "/";
|
||||
}
|
||||
|
||||
RequestBody body = RequestBody.create(null, new byte[0]);
|
||||
RequestBody body = RequestBody.create(new byte[0]);
|
||||
req = new Request.Builder()
|
||||
.url(url)
|
||||
.method("POST", body)
|
||||
|
|
|
@ -29,6 +29,7 @@ public class StreamateHttpClient extends HttpClient {
|
|||
private static final String SAKEY_KEY = "sakey";
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(StreamateHttpClient.class);
|
||||
public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
|
||||
|
||||
private Long userId;
|
||||
private String saKey = "";
|
||||
|
@ -106,7 +107,7 @@ public class StreamateHttpClient extends HttpClient {
|
|||
loginRequest.put("siteId", 1);
|
||||
loginRequest.put("siteType", "premium");
|
||||
loginRequest.put("tzOffsetMinutes", 0);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), loginRequest.toString());
|
||||
RequestBody body = RequestBody.Companion.create(loginRequest.toString(), JSON);
|
||||
Request login = newRequestBuilder()
|
||||
.url(Streamate.BASE_URL + "/api/member/login")
|
||||
.post(body)
|
||||
|
|
|
@ -2,6 +2,7 @@ package ctbrec.sites.streamate;
|
|||
|
||||
import static ctbrec.Model.State.*;
|
||||
import static ctbrec.io.HttpConstants.*;
|
||||
import static ctbrec.sites.streamate.StreamateHttpClient.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -25,7 +26,6 @@ import ctbrec.Config;
|
|||
import ctbrec.NotImplementedExcetion;
|
||||
import ctbrec.io.HttpException;
|
||||
import ctbrec.recorder.download.StreamSource;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
@ -204,7 +204,7 @@ public class StreamateModel extends AbstractModel {
|
|||
requestParams.put("pid", id);
|
||||
requestParams.put("domain", "streamate.com");
|
||||
requestParams.put("fav", follow);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), requestParams.toString());
|
||||
RequestBody body = RequestBody.Companion.create(requestParams.toString(), JSON);
|
||||
|
||||
String url = site.getBaseUrl() + "/ajax/fav-notify.php?userid="+userId+"&sakey="+saKey+"&pid="+id+"&fav="+follow+"&domain=streamate.com";
|
||||
Request request = new Request.Builder()
|
||||
|
|
|
@ -20,6 +20,7 @@ import okhttp3.Response;
|
|||
public class StripchatHttpClient extends HttpClient {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(StripchatHttpClient.class);
|
||||
public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
|
||||
|
||||
private long userId;
|
||||
private String csrfToken;
|
||||
|
@ -61,7 +62,7 @@ public class StripchatHttpClient extends HttpClient {
|
|||
requestParams.put("csrfToken", csrfToken);
|
||||
requestParams.put("csrfTimestamp", csrfTimestamp);
|
||||
requestParams.put("csrfNotifyTimestamp", csrfNotifyTimestamp);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), requestParams.toString());
|
||||
RequestBody body = RequestBody.Companion.create(requestParams.toString(), JSON);
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.header(ACCEPT, MIMETYPE_APPLICATION_JSON)
|
||||
|
|
|
@ -2,6 +2,7 @@ package ctbrec.sites.stripchat;
|
|||
|
||||
import static ctbrec.Model.State.*;
|
||||
import static ctbrec.io.HttpConstants.*;
|
||||
import static ctbrec.sites.stripchat.StripchatHttpClient.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -25,7 +26,6 @@ import ctbrec.AbstractModel;
|
|||
import ctbrec.Config;
|
||||
import ctbrec.io.HttpException;
|
||||
import ctbrec.recorder.download.StreamSource;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
@ -183,7 +183,7 @@ public class StripchatModel extends AbstractModel {
|
|||
requestParams.put("csrfToken", client.getCsrfToken());
|
||||
requestParams.put("csrfTimestamp", client.getCsrfTimestamp());
|
||||
requestParams.put("csrfNotifyTimestamp", client.getCsrfNotifyTimestamp());
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), requestParams.toString());
|
||||
RequestBody body = RequestBody.Companion.create(requestParams.toString(), JSON);
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.header(ACCEPT, "*/*")
|
||||
|
@ -218,7 +218,7 @@ public class StripchatModel extends AbstractModel {
|
|||
requestParams.put("csrfToken", client.getCsrfToken());
|
||||
requestParams.put("csrfTimestamp", client.getCsrfTimestamp());
|
||||
requestParams.put("csrfNotifyTimestamp", client.getCsrfNotifyTimestamp());
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), requestParams.toString());
|
||||
RequestBody body = RequestBody.Companion.create(requestParams.toString(), JSON);
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.header(ACCEPT, MIMETYPE_APPLICATION_JSON)
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.10.0</version>
|
||||
<version>4.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.moshi</groupId>
|
||||
|
|
Loading…
Reference in New Issue