当前位置: 首页 > news >正文

私自建立网站网站判决书网站超链接怎么做

私自建立网站网站判决书,网站超链接怎么做,大型网站团队人数,做旅游的网站的要素实际工作中#xff0c;需要用阿里云对象存储保存图片#xff0c;并且在上传图片到阿里云对象存储服务器后#xff0c;获取图片在阿里云对象存储服务器的URL地址#xff0c;以便给 WEB 前端显示。 阿里云对象存储上传图片的工具类 package zhangchao;import com.aliyun.os…实际工作中需要用阿里云对象存储保存图片并且在上传图片到阿里云对象存储服务器后获取图片在阿里云对象存储服务器的URL地址以便给 WEB 前端显示。 阿里云对象存储上传图片的工具类 package zhangchao;import com.aliyun.oss.ClientException; import com.aliyun.oss.OSS; import com.aliyun.oss.OSSClientBuilder; import com.aliyun.oss.OSSException; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; import java.util.Date; import java.util.UUID;/*** 阿里云对象存储工具类*/ public class OSSUtils {// OSS阿里云对象存储的AK和SKprivate static final String OSS_AK yourAK;private static final String OSS_SK yourSK;// OSS阿里云对象存储的Bucket名称private static final String OSS_BUCKET_NAME your-files;// Endpoint以华东1杭州为例其它Region请按实际情况填写。private static final String OSS_ENDPOINT https://oss-cn-hangzhou.aliyuncs.com;/*** 上传图片并返回图片URL* return 图片URL*/public static String uploadImage(String imageFilePath) {String result null;// 创建OSSClient实例。OSS ossClient new OSSClientBuilder().build(OSS_ENDPOINT, OSS_AK, OSS_SK);FileInputStream fis null;try {// 创建存储空间。fis new FileInputStream(imageFilePath);String uuid UUID.randomUUID().toString().replaceAll(-, );ossClient.putObject(OSS_BUCKET_NAME, uuid, fis);// 设置URL过期时间为10年 3600l * 1000 * 24 * 365 * 10Date expiration new Date(System.currentTimeMillis() 3600L * 1000L *24L * 365L * 10L);URL url ossClient.generatePresignedUrl(OSS_BUCKET_NAME, uuid, expiration);if (url ! null) {result url.toString();}} catch (OSSException oe) {StringBuilder sb new StringBuilder();sb.append(Caught an OSSException, which means your request made it to OSS, ).append(but was rejected with an error response for some reason.);sb.append(Error Message:).append(oe.getErrorMessage());sb.append(Error Code:).append(oe.getErrorCode());sb.append(Request ID:).append(oe.getRequestId());sb.append(Host ID:).append(oe.getHostId());System.out.println(sb.toString());} catch (ClientException ce) {StringBuilder sb new StringBuilder();sb.append(Caught an ClientException, which means the client encountered ).append(a serious internal problem while trying to communicate with OSS, ).append(such as not being able to access the network.);sb.append(Error Message: ce.getMessage());System.out.println(sb.toString());ce.printStackTrace();} catch (FileNotFoundException e) {e.printStackTrace();} finally {try {if (null ! fis) {fis.close();}} catch (IOException e) {e.printStackTrace();}if (ossClient ! null) {ossClient.shutdown();}}return result;} } 调用的 main 方法 package zhangchao;public class Main {public static void main(String[] args) {String imgUrl OSSUtils.uploadImage(E:\\ws\\zc\\Java8OSSImg\\src\\main\\resources\\q1.jpg);System.out.println(imgUrl);} }运行结果这里显示了返回的图片 URL 地址 https://your-files.oss-cn-hangzhou.aliyuncs.com/abc123?Expires2021599742OSSAccessKeyIdyouAKSignaturexxxxxx这个地址没办法用浏览器直接看需要写个HTML来测试一下。 !DOCTYPE html html langen headmeta charsetUTF-8titleTitle/title /head bodyimg srchttps://your-files.oss-cn-hangzhou.aliyuncs.com/abc123?Expires2021599742OSSAccessKeyIdyouAKSignaturexxxxxx /body /html
http://www.zqtcl.cn/news/557752/

相关文章:

  • 广州专业网站制作设计网站建设分几种
  • 有没有专业做艺术品的网站长沙人才市场招聘信息
  • 河池做网站通过邮箱查注册网站
  • 金融互助网站开发网上免费设计效果图
  • 网站开发 例子施工企业质量管理体系应按照我国
  • 义乌建设网站网络营销推广有哪些方法
  • 宿迁建设局网站a类证查询怎么自己搭建梯子
  • 成都网站品牌设计策划网络推广如何收费
  • html5 js全屏滑动网站源码wordpress 插件 破解
  • 做电影网站怎么批量去水印微信用什么小程序可以提取文字
  • 网站开发费用周期域名网站建设方案书模板
  • 织梦网站问题关于政务网站建设工作情况的总结
  • wordpress 拿站网站搭建后如何使用
  • 网站设计应遵循的原则wordpress免费空间
  • 建设网站的特色企业内部培训app软件
  • jsp网站缓存在哪wordpress设置静态页面
  • 百度做网站电话多少东台网页定制
  • 暖通设计网站推荐百度在西安的公司叫什么
  • 天津响应式网站设计网站建设的任务
  • 多语言网站 自助江门建设局网站
  • 宜兴做阿里巴巴网站常州外贸网站设计
  • 长沙米拓建站wordpress最底部版权
  • 小企业网站建设费用一年wordpress 怎么登陆
  • 阿里云建站可不可以备案wordpress评论滑动插件
  • 网站建设教程出售用苏州久远网络现在的网络营销方式
  • 浮动播放器wordpress刷神马seo排名首页排名
  • 建设网站呼叫中心有什么好处站长统计免费下载
  • 做网站电脑配置要求个高吗电子商务网站的建设包含哪些流程图
  • 青岛做网站大公司wordpress文章页加一言
  • 用哪个网站做相册视频文件夹谷歌ads