我正在尝试使用retrofit2REST客户端从我的移动应用程序中删除一些媒体.
@HTTP(method = "DELETE",path="/api/v1/media/{username}/{accesstoken}", hasBody = true)
Call<MyResponse> deleteArchiveMedia(@Path("username") String username, @Path("accesstoken") String token ,
@Body DeleteMedia deleteMedia);
Run Code Online (Sandbox Code Playgroud)
这是删除的要求.
DeleteMedia是一个包含2个数组列表的类,一个用于channelId,另一个用于Mediaid
删除一些媒体(小于100)时删除工作正常,但删除超过100个媒体时,它将返回如下错误:
recvfrom failed: ECONNRESET (Connection reset by peer)
Run Code Online (Sandbox Code Playgroud)
为什么只有当我试图删除大量的媒体时才会发生这种情况?
retroffit2体长是否有限制?
请帮我......
获得改造的课程public class DeleteModule {
private static Retrofit retrofit = null;
public static Retrofit getClient() {
System.setProperty("http.keepAlive", "false");
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
.readTimeout(60, TimeUnit.SECONDS)
.connectTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60,TimeUnit.SECONDS)
.build();
if (retrofit == null) {
retrofit = new Retrofit.Builder()
.baseUrl(Constants.getBaseURL())
.addConverterFactory(GsonConverterFactory.create()).client(okHttpClient)
.build();
}
return retrofit;
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用签名URL将视频文件上传到云存储.HTTP put方法用于上传.当我尝试使用"HttpsUrl`连接"进行连接时,它会返回一些错误,如javax.net.ssl.SSLHandshakeException:握手失败.我该如何解决这个问题?这是我的代码:
URL url = new URL(url_string);
httpsUrlConnection = (HttpsURLConnection) url.openConnection();
httpsUrlConnection.setDoOutput(true);
httpsUrlConnection.setDoInput(true);
httpsUrlConnection.setRequestMethod(requestMethod);
httpsUrlConnection.setRequestProperty("Content-Type", "application/json");
httpsUrlConnection.setRequestProperty("Accept", "application/json");
httpsUrlConnection.connect();
Run Code Online (Sandbox Code Playgroud)
stacktrace就是这样的
javax.net.ssl.SSLHandshakeException: Handshake failed
com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:390c)
com.android.okhttp.Connection.upgradeToTls(Connection.java:201)
Run Code Online (Sandbox Code Playgroud) ssl android google-cloud-storage httpsurlconnection pre-signed-url