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