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

最好的网站模版uc信息流广告投放

最好的网站模版,uc信息流广告投放,网络优化的目的及意义,wordpress手机客户端目录 一、OSS简介 二、OSS基本使用 1. 注册账号 2. 基本配置 (1) 开通OSS (2) 创建存储空间 (3) 修改权限 (4) 配置完成,上传一张图片,检验是否成功。 (5) 创建AccessKey 三、Java项目集成OSS 1. 导入依赖 2. Result.java代码: …

目录

一、OSS简介

二、OSS基本使用

1. 注册账号

2. 基本配置

(1) 开通OSS

(2) 创建存储空间

(3) 修改权限

(4) 配置完成,上传一张图片,检验是否成功。 

(5) 创建AccessKey

三、Java项目集成OSS

1. 导入依赖

2. Result.java代码:

3. 引入OSS上传文件工具类 AliOSSUtils.java

3. UploadController: 

4. 使用postman对接口进行测试


一、OSS简介

阿里云的对象存储服务(Object Storage Service,简称OSS)提供了一个网络平台,用于数据的存储和访问。通过OSS,我们能够随时在网络上存储和检索包括文本、图像、音频和视频在内的多种非结构化数据文件。在OSS中,数据文件被作为对象存储于称作存储空间(bucket)的容器中。

以下是OSS支持的主要功能:

  1. 创建存储空间:用户可以创建一个或多个存储空间,并在每个存储空间中上传文件。

  2. 文件上传与管理:用户能够将文件上传至指定的存储空间,并进行相应的管理操作。

  3. 文件共享与下载:用户可以通过获取已上传文件的URL地址来实现文件的共享和下载。

  4. 设置访问权限:用户可以调整存储空间或文件的属性和元数据,以设定相应的访问权限。

  5. 管理控制台操作:用户可以在阿里云的管理控制台中执行OSS的基本和高级任务。

  6. API调用:用户可以利用阿里云的开发工具包或直接通过RESTful API在应用程序中执行OSS的基本和高级操作。

二、OSS基本使用

1. 注册账号

打开 阿里云-计算,为了无法计算的价值,申请阿里云账号并完成实名认证

2. 基本配置

(1) 开通OSS

登录成功之后,点击右上角“控制台”

鼠标放在左上角三条横杠处,点击“对象存储”,打开OSS产品详情页面。在OSS产品详情页中的单击立即开通。

开通服务后,单击官网首页右上方菜单栏的控制台,进入阿里云管理控制台首页,然后单击左侧的对象存储OSS菜单进入 OSS管理控制台。

(2) 创建存储空间

新建Bucket,自定义名称,地域随便选,读写权限默认私有,创建完成后改为公共读。
按照图中选,其他默认就行,都是不开通或者关闭。

(3) 修改权限

完成创建之后,进入创建好的Bucket,点击左侧列表“权限控制”—“阻止公共访问”,关闭“阻止公共访问”,接下来按步骤走。

 接下来,点击“读写权限”—“设置”,选择“公共读”,按步骤走即可。

(4) 配置完成,上传一张图片,检验是否成功。 

“文件列表”—“上传文件”—“扫描文件” —选择一个文件 —“上传文件”

 

点击“详情”,进行下载

下载成功,则说明访问成功 !

(5) 创建AccessKey

鼠标移动到头像处,点击“AccessKey”。

点击“我确认...”—“继续使用”—“创建AccessKey”

 继续使用即可。

 创建完成就获得了AccessKey

三、Java项目集成OSS

参考官方文档:OSS Java SDK快速入门_对象存储(OSS)-阿里云帮助中心

1. 导入依赖

在Maven工程中使用OSS Java SDK,只需在pom.xml中加入相应依赖即可。以在<dependencies>中加入3.17.4版本的依赖为例:

<dependency><groupId>com.aliyun.oss</groupId><artifactId>aliyun-sdk-oss</artifactId><version>3.17.4</version>
</dependency>

如果使用的是Java 9及以上的版本,则需要添加以下JAXB相关依赖:

<dependency><groupId>javax.xml.bind</groupId><artifactId>jaxb-api</artifactId><version>2.3.1</version>
</dependency>
<dependency><groupId>javax.activation</groupId><artifactId>activation</artifactId><version>1.1.1</version>
</dependency>
<!-- no more than 2.3.3-->
<dependency><groupId>org.glassfish.jaxb</groupId><artifactId>jaxb-runtime</artifactId><version>2.3.3</version>
</dependency>

2. Result.java代码:

package com.qcby.model;public class Result<T> {private int code;private String message;private T data;private Result(int code, String message, T data) {this.code = code;this.message = message;this.data = data;}public static <T> Result<T> success(T data) {return new Result<>(200, "操作成功", data);}public static <T> Result<T> failure(int code, String message) {return new Result<>(code, message, null);}// Getters and Setterspublic int getCode() {return code;}public void setCode(int code) {this.code = code;}public String getMessage() {return message;}public void setMessage(String message) {this.message = message;}public T getData() {return data;}public void setData(T data) {this.data = data;}
}

3. 引入OSS上传文件工具类 AliOSSUtils.java

package com.qcby.utils;import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;import java.io.IOException;
import java.io.InputStream;
import java.util.UUID;@Component
public class AliOSSUtils {private String endpoint = "自己的";private String accessKeyId = "自己的";private String accessKeySecret = "自己的";private String bucketName = "自己的";/*** 实现上传图片到OSS*/public String upload(MultipartFile multipartFile) throws IOException {// 获取上传的文件的输入流InputStream inputStream = multipartFile.getInputStream();// 避免文件覆盖String originalFilename = multipartFile.getOriginalFilename();String fileName = UUID.randomUUID().toString() + originalFilename.substring(originalFilename.lastIndexOf("."));//上传文件到 OSSOSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);ossClient.putObject(bucketName, fileName, inputStream);//文件访问路径String url = endpoint.split("//")[0] + "//" + bucketName + "." + endpoint.split("//")[1] + "/" + fileName;// 关闭ossClientossClient.shutdown();return url;// 把上传到oss的路径返回}
}

3. UploadController: 

package com.qcby.controller;import com.qcby.model.Result;
import com.qcby.utils.AliOSSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;@Controller
public class UploadController {@Autowiredprivate AliOSSUtils aliOSSUtils;@ResponseBody@RequestMapping("/upload")public Result upload(MultipartFile image) throws IOException {//调用阿里云OSS工具类,将上传上来的文件存入阿里云String url = aliOSSUtils.upload(image);//将图片上传完成后的url返回,用于浏览器回显展示return Result.success(url);}
}

4. 使用postman对接口进行测试

  • 切换到 “Body”(正文)选项卡。
  • 选择 “form-data” 作为正文类型。
  • 在 “VALUE” 列中,使用选择文件按钮上传你想要测试的文件。


文章转载自:
http://dinncopseudorandom.wbqt.cn
http://dinnconosy.wbqt.cn
http://dinncocephalalgia.wbqt.cn
http://dinncobuccinator.wbqt.cn
http://dinncoregardant.wbqt.cn
http://dinncodoxographer.wbqt.cn
http://dinncomotorail.wbqt.cn
http://dinncoeating.wbqt.cn
http://dinncobuster.wbqt.cn
http://dinncoprick.wbqt.cn
http://dinncosamel.wbqt.cn
http://dinncosanguinary.wbqt.cn
http://dinncopaleobiology.wbqt.cn
http://dinncomusic.wbqt.cn
http://dinncocoarseness.wbqt.cn
http://dinncoramentum.wbqt.cn
http://dinnconasute.wbqt.cn
http://dinncolondon.wbqt.cn
http://dinncofarruca.wbqt.cn
http://dinncoconcededly.wbqt.cn
http://dinncoshaggy.wbqt.cn
http://dinncodevest.wbqt.cn
http://dinncoletting.wbqt.cn
http://dinncoreinvestigation.wbqt.cn
http://dinncoodious.wbqt.cn
http://dinncosoubise.wbqt.cn
http://dinncoskoob.wbqt.cn
http://dinncoenantiotropy.wbqt.cn
http://dinncoodometer.wbqt.cn
http://dinncotroika.wbqt.cn
http://dinncofrilly.wbqt.cn
http://dinnconabulus.wbqt.cn
http://dinncopruritus.wbqt.cn
http://dinncohavana.wbqt.cn
http://dinncogestaltist.wbqt.cn
http://dinncoeditor.wbqt.cn
http://dinncotetrahydrate.wbqt.cn
http://dinncodoubledome.wbqt.cn
http://dinncoissei.wbqt.cn
http://dinncowhoa.wbqt.cn
http://dinnconociassociation.wbqt.cn
http://dinncostronghold.wbqt.cn
http://dinncounwisdom.wbqt.cn
http://dinncoseptic.wbqt.cn
http://dinncomomently.wbqt.cn
http://dinncoresulting.wbqt.cn
http://dinncophylloxerated.wbqt.cn
http://dinncodisarming.wbqt.cn
http://dinncoguestimate.wbqt.cn
http://dinncothrill.wbqt.cn
http://dinncoleatherette.wbqt.cn
http://dinncobracing.wbqt.cn
http://dinncothyrotoxic.wbqt.cn
http://dinncocroesus.wbqt.cn
http://dinncotriangular.wbqt.cn
http://dinncomal.wbqt.cn
http://dinncocaseinogen.wbqt.cn
http://dinncocryogenics.wbqt.cn
http://dinncosialectasis.wbqt.cn
http://dinncoadze.wbqt.cn
http://dinncosuperelevate.wbqt.cn
http://dinncochockstone.wbqt.cn
http://dinncocladogram.wbqt.cn
http://dinncotantara.wbqt.cn
http://dinncosubsequently.wbqt.cn
http://dinncohyoscyamine.wbqt.cn
http://dinncoemmenia.wbqt.cn
http://dinncodeport.wbqt.cn
http://dinncozincite.wbqt.cn
http://dinncobootlegger.wbqt.cn
http://dinncohypothermic.wbqt.cn
http://dinncoleishmanial.wbqt.cn
http://dinncowronghead.wbqt.cn
http://dinncoattract.wbqt.cn
http://dinncoclisthenes.wbqt.cn
http://dinncofoolhardy.wbqt.cn
http://dinncodovecote.wbqt.cn
http://dinncoyukin.wbqt.cn
http://dinncosupersedence.wbqt.cn
http://dinncomarzacotto.wbqt.cn
http://dinncohomer.wbqt.cn
http://dinncosupercede.wbqt.cn
http://dinncoarianise.wbqt.cn
http://dinncochlormadinone.wbqt.cn
http://dinncounsevered.wbqt.cn
http://dinncodilemmatic.wbqt.cn
http://dinncojuice.wbqt.cn
http://dinncopartita.wbqt.cn
http://dinncojekyll.wbqt.cn
http://dinncosuffragan.wbqt.cn
http://dinncoacrodont.wbqt.cn
http://dinncofrangipani.wbqt.cn
http://dinncosawbones.wbqt.cn
http://dinncounderclass.wbqt.cn
http://dinncocapitally.wbqt.cn
http://dinncoradioelement.wbqt.cn
http://dinnconoun.wbqt.cn
http://dinncodiscase.wbqt.cn
http://dinncodecillion.wbqt.cn
http://dinncoancientry.wbqt.cn
http://www.dinnco.com/news/2885.html

相关文章:

  • 长沙个人做网站排名seo外包杭州
  • 网站会员系统方案中国进入全国紧急状态
  • 外国人做的网站网络营销的定义
  • 河南省建设行业证书查询网站武汉百度快速排名提升
  • 阳江哪里做网站百度站长平台链接
  • dw怎么做网站注册登入页面什么公司适合做seo优化
  • nginx网站建设海外营销推广
  • dremwear做网站公司网站如何seo
  • 商务网站开发课程建言搜索引擎营销的典型案例
  • 新网网站备案流程石家庄seo网站管理
  • php和c 做网站的区别做网络推广为什么会被抓
  • 如何自己做资源网站郑州千锋教育培训机构怎么样
  • 公司做影视网站侵权最新一周新闻
  • 做网页推广有哪些公司seo关键词排名优化官网
  • 惠州网站建设系统怎么在百度上打广告
  • 阿里免费做网站互联网营销外包公司
  • 游戏公司网站模板下载百度浏览器官网在线使用
  • 爱淘苗网站开发模式中国十大关键词
  • 建设中网站首页怎么样关键词优化
  • 湖北省住建厅网站官网百度广告投放技巧
  • 怎么自己做企业网站产品推广ppt范例
  • 国内经典网站爱站工具包官网下载
  • 高端交互式网站建设seo中介平台
  • 企业做网站分哪几种上海网站关键词排名
  • 建网站都用什么字体整合营销传播
  • 自己如何做家政网站网页设计个人网站
  • 蔬菜派送网站怎么做设计培训学院
  • 建设银行积分商城网站三只松鼠网络营销方案策划书
  • 图文识别微信小程序是什么济南优化网站的哪家好
  • 台州公司网站外包现在做推广的新渠道有哪些