mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 21:01:33 +02:00
Revert "Update dependencies to latest stable versions"
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package uk.ac.ic.wlgitbridge.bridge.resource;
|
||||
|
||||
import static org.asynchttpclient.Dsl.*;
|
||||
import com.ning.http.client.AsyncHttpClient;
|
||||
import uk.ac.ic.wlgitbridge.bridge.db.DBStore;
|
||||
import uk.ac.ic.wlgitbridge.data.filestore.RawFile;
|
||||
import uk.ac.ic.wlgitbridge.data.filestore.RepositoryFile;
|
||||
@@ -31,7 +31,7 @@ public class UrlResourceCache implements ResourceCache {
|
||||
}
|
||||
|
||||
public UrlResourceCache(DBStore dbStore) {
|
||||
this(dbStore, new NingHttpClient(asyncHttpClient()));
|
||||
this(dbStore, new NingHttpClient(new AsyncHttpClient()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,7 +82,8 @@ public class UrlResourceCache implements ResourceCache {
|
||||
Log.info("GET -> " + url);
|
||||
try {
|
||||
contents = http.get(url, hs -> {
|
||||
List<String> contentLengths = hs.getAll("Content-Length");
|
||||
List<String> contentLengths
|
||||
= hs.getHeaders().get("Content-Length");
|
||||
if (!maxFileSize.isPresent()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package uk.ac.ic.wlgitbridge.bridge.swap.store;
|
||||
|
||||
import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
||||
import com.amazonaws.auth.BasicAWSCredentials;
|
||||
import com.amazonaws.services.s3.AmazonS3;
|
||||
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
||||
import com.amazonaws.services.s3.AmazonS3Client;
|
||||
import com.amazonaws.services.s3.model.*;
|
||||
|
||||
import java.io.InputStream;
|
||||
@@ -30,7 +29,7 @@ public class S3SwapStore implements SwapStore {
|
||||
String secret,
|
||||
String bucketName
|
||||
) {
|
||||
s3 = AmazonS3ClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secret))).build();
|
||||
s3 = new AmazonS3Client(new BasicAWSCredentials(accessKey, secret));
|
||||
this.bucketName = bucketName;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package uk.ac.ic.wlgitbridge.io.http.ning;
|
||||
|
||||
import io.netty.handler.codec.http.HttpHeaders;
|
||||
import org.asynchttpclient.*;
|
||||
import com.ning.http.client.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import uk.ac.ic.wlgitbridge.util.FunctionT;
|
||||
@@ -24,7 +23,7 @@ public class NingHttpClient implements NingHttpClientFacade {
|
||||
@Override
|
||||
public <E extends Exception> byte[] get(
|
||||
String url,
|
||||
FunctionT<HttpHeaders, Boolean, E> handler
|
||||
FunctionT<HttpResponseHeaders, Boolean, E> handler
|
||||
) throws ExecutionException {
|
||||
try {
|
||||
return http
|
||||
@@ -34,19 +33,19 @@ public class NingHttpClient implements NingHttpClientFacade {
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
|
||||
@Override
|
||||
public State onHeadersReceived(
|
||||
HttpHeaders headers
|
||||
public STATE onHeadersReceived(
|
||||
HttpResponseHeaders headers
|
||||
) throws E {
|
||||
return handler.apply(headers)
|
||||
? State.CONTINUE : State.ABORT;
|
||||
? STATE.CONTINUE : STATE.ABORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State onBodyPartReceived(
|
||||
public STATE onBodyPartReceived(
|
||||
HttpResponseBodyPart content
|
||||
) throws IOException {
|
||||
bytes.write(content.getBodyPartBytes());
|
||||
return State.CONTINUE;
|
||||
return STATE.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package uk.ac.ic.wlgitbridge.io.http.ning;
|
||||
|
||||
import io.netty.handler.codec.http.HttpHeaders;
|
||||
import com.ning.http.client.HttpResponseHeaders;
|
||||
import uk.ac.ic.wlgitbridge.util.FunctionT;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -16,7 +16,7 @@ public interface NingHttpClientFacade {
|
||||
*/
|
||||
<E extends Exception> byte[] get(
|
||||
String url,
|
||||
FunctionT<HttpHeaders, Boolean, E> handler
|
||||
FunctionT<HttpResponseHeaders, Boolean, E> handler
|
||||
) throws ExecutionException;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package uk.ac.ic.wlgitbridge.io.http.ning;
|
||||
|
||||
import com.ning.http.client.FluentCaseInsensitiveStringsMap;
|
||||
import com.ning.http.client.HttpResponseHeaders;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class NingHttpHeaders extends HttpResponseHeaders {
|
||||
|
||||
private final FluentCaseInsensitiveStringsMap map;
|
||||
|
||||
private NingHttpHeaders(FluentCaseInsensitiveStringsMap map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public static NingHttpHeadersBuilder builder() {
|
||||
return new NingHttpHeadersBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluentCaseInsensitiveStringsMap getHeaders() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public static class NingHttpHeadersBuilder {
|
||||
|
||||
private final Map<String, Collection<String>> map;
|
||||
|
||||
private NingHttpHeadersBuilder() {
|
||||
map = new HashMap<>();
|
||||
}
|
||||
|
||||
public NingHttpHeadersBuilder addHeader(String key, String... values) {
|
||||
map.computeIfAbsent(key, __ -> new ArrayList<>())
|
||||
.addAll(Arrays.asList(values));
|
||||
return this;
|
||||
}
|
||||
|
||||
public NingHttpHeaders build() {
|
||||
return new NingHttpHeaders(
|
||||
new FluentCaseInsensitiveStringsMap(map));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,7 @@ package uk.ac.ic.wlgitbridge.snapshot.base;
|
||||
import com.google.api.client.http.*;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.asynchttpclient.AsyncHttpClient;
|
||||
import static org.asynchttpclient.Dsl.*;
|
||||
import com.ning.http.client.AsyncHttpClient;
|
||||
import uk.ac.ic.wlgitbridge.snapshot.exception.FailedConnectionException;
|
||||
import uk.ac.ic.wlgitbridge.util.Instance;
|
||||
import uk.ac.ic.wlgitbridge.util.Log;
|
||||
@@ -18,7 +17,7 @@ import java.util.concurrent.*;
|
||||
*/
|
||||
public abstract class Request<T extends Result> {
|
||||
|
||||
public static final AsyncHttpClient httpClient = asyncHttpClient();
|
||||
public static final AsyncHttpClient httpClient = new AsyncHttpClient();
|
||||
|
||||
private static final Executor executor = Executors.newCachedThreadPool();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package uk.ac.ic.wlgitbridge.snapshot.servermock.server;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import static org.asynchttpclient.Dsl.*;
|
||||
import com.ning.http.client.AsyncHttpClient;
|
||||
import uk.ac.ic.wlgitbridge.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -30,9 +30,17 @@ public class PostbackThread extends Thread {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
asyncHttpClient().preparePost(
|
||||
new AsyncHttpClient().preparePost(
|
||||
url
|
||||
).setBody(postback).execute().get().getResponseBody();
|
||||
} catch (IOException e) {
|
||||
Log.warn(
|
||||
"IOException on postback, url: " +
|
||||
url +
|
||||
", postback: " +
|
||||
postback,
|
||||
e
|
||||
);
|
||||
} catch (InterruptedException e) {
|
||||
Log.warn(
|
||||
"Interrupted on postback, url: " +
|
||||
|
||||
Reference in New Issue
Block a user