Open DemonHJS opened 2 years ago
setObjectAcl(String bucketName, String objectKey, AccessControlList acl)
protected okhttp3.Request.Builder setupConnection(HttpMethodEnum method, String bucketName, String objectKey, Map<String, String> requestParameters, RequestBody body, boolean isOEF, boolean isListBuckets) throws ServiceException { boolean pathStyle = this.isPathStyle(); String endPoint = this.getEndpoint(); boolean isCname = this.isCname(); String hostname = !isCname && !isListBuckets ? ServiceUtils.generateHostnameForBucket(RestUtils.encodeUrlString(bucketName), pathStyle, endPoint) : endPoint; String resourceString = "/"; if (hostname.equals(endPoint) && !isCname && bucketName.length() > 0) { resourceString = resourceString + RestUtils.encodeUrlString(bucketName); } if (objectKey != null) { resourceString = resourceString + (pathStyle && !isCname ? "/" : "") + RestUtils.encodeUrlString(objectKey); } String url = this.addProtocol(hostname, resourceString); url = this.addRequestParametersToUrlPath(url, requestParameters, isOEF); okhttp3.Request.Builder builder = this.createRequestBuilder(method, body, url); return builder; }
public static String encodeUrlString(String path) throws ServiceException { try { return URLEncoder.encode(path, "UTF-8").replaceAll("\\+", "%20").replaceAll("%7E", "~").replaceAll("\\*", "%2A"); } catch (UnsupportedEncodingException var2) { throw new ServiceException("Unable to encode path: " + path, var2); } }
通过这个可以设置不进行编码 setObjectAclRequest.setIsEncodeHeaders(false);
版本号
调用方法
setObjectAcl(String bucketName, String objectKey, AccessControlList acl)
com.obs.services.internal.RestConnectionService
com.obs.services.internal.utils.RestUtils