use of com.qcloud.cos.model.ciModel.job.DocHtmlRequest in project cos-java-sdk-v5 by tencentyun.
the class COSClient method buildDocPreview.
private String buildDocPreview(CosHttpRequest<DocHtmlRequest> request) throws URISyntaxException {
String urlStr = request.getProtocol().toString() + "://" + request.getEndpoint() + request.getResourcePath();
URIBuilder uriBuilder = new URIBuilder(urlStr);
COSSigner cosSigner = clientConfig.getCosSigner();
Date expiredTime = new Date(System.currentTimeMillis() + clientConfig.getSignExpired() * 1000);
String authoriationStr = cosSigner.buildAuthorizationStr(request.getHttpMethod(), request.getResourcePath(), request.getHeaders(), request.getParameters(), fetchCredential(), expiredTime, true);
DocHtmlRequest originalRequest = request.getOriginalRequest();
uriBuilder.addParameter("ci-process", "doc-preview");
uriBuilder.addParameter("dsttype", originalRequest.getType().toString());
uriBuilder.addParameter("srcType", originalRequest.getSrcType());
uriBuilder.addParameter("page", originalRequest.getPage());
uriBuilder.addParameter("ImageParams", originalRequest.getImageParams());
uriBuilder.addParameter("sheet", originalRequest.getSheet());
uriBuilder.addParameter("password", originalRequest.getPassword());
uriBuilder.addParameter("comment", originalRequest.getComment());
uriBuilder.addParameter("excelPaperDirection", originalRequest.getExcelPaperDirection());
uriBuilder.addParameter("quality", originalRequest.getQuality());
uriBuilder.addParameter("scale", originalRequest.getScale());
return uriBuilder.build().toString() + "&" + authoriationStr;
}
use of com.qcloud.cos.model.ciModel.job.DocHtmlRequest in project cos-java-sdk-v5 by tencentyun.
the class DocJobDemo method generateDocPreviewUrl.
/**
* GenerateDocPreviewUrl 生成文档预览同步请求预览地址
* https://cloud.tencent.com/document/product/460/47074
*/
public static void generateDocPreviewUrl(COSClient client) throws URISyntaxException {
// 1.创建任务请求对象
DocHtmlRequest request = new DocHtmlRequest();
// 2.添加请求参数 参数详情请见api接口文档
request.setBucketName("markjrzhang-1251704708");
request.setType(DocHtmlRequest.DocType.html);
request.setObjectKey("1.pptx");
// 3.调用接口,获取任务响应对象
String previewUrl = client.GenerateDocPreviewUrl(request);
System.out.println(previewUrl);
}
Aggregations