我正在尝试使用签名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
我有一个模板,其中照片显示在一个框架中(每个框架对于不同的图像是不同的).我已经编写了一个功能,使用图像原始的高度和宽度,并给我自定义的宽度和高度为该特定框架,以便恢复宽高比.现在我通过onload调用该函数,因为图像在特定时刻加载.
我的feed.hbs(模板)
<img src = "{{photo.0.photo_url}}" onload = "OnImageLoad(event);" {{action "imgOverlay0" photo}}/>
Run Code Online (Sandbox Code Playgroud)
功能
function OnImageLoad(evt) {
var img = evt.currentTarget;
// what's the size of this image and it's parent
var w = $(img).width();
var h = $(img).height();
var tw = $(img).parent().width();
var th = $(img).parent().height();
// compute the new size and offsets
var result = scaling(w, h, tw, th,false);
// adjust the image coordinates and size
img.width = result.width;
img.height = result.height;
$(img).css("margin-left", result.targetleft);
$(img).css("margin-top", result.targettop);
// console.log("result",result)
return …Run Code Online (Sandbox Code Playgroud)