IJ:ALI OSS 配置
ylbtech-IJ:ALI OSS 配置 |
1. src/resources/返回顶部 |
# oss\u7684\u5916\u7f51\u57df\u540d
ENDPOINT = oss-cn-beijing.aliyuncs.com
# oss\u7684Access Key ID
ACCESS_KEY_ID = LTAIL15ejxI1XXXi
#oss\u7684Access Key Secret
ACCESS_KEY_SECRET = EBA8t6QzgvHQQ0ixcgeLHcyfXGXXXj
#oss\u7684bucket\u540d\u79f0
BACKET_NAME = xxxbucket
#oss\u7684\u6587\u4ef6\u5939\u540d\u79f0
FOLDER = shineyoo/ #PARTNER_ID =
#AUTH_URL = Http://jf.dingcan365.com/jiaofei/ghkd/auth/
#RECHARGE_URL = Http://jf.dingcan365.com/jiaofei/ghkd/pay/
#QUERY_URL = Http://jf.dingcan365.com/jiaofei/ghkd/orderQuery/
#VERSION = 1.0
#COMM_ID =
#P_KEY = GKpt~!@#JJNET
#DATE_FORMAT = yyyyMMddHHmmss
2. src/java/返回顶部 |
package com.shineyoo.manager.util.common.aliyun.oss; import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.Bucket;
import com.aliyun.oss.model.CannedAccessControlList;
import com.aliyun.oss.model.OSSObject;
import com.aliyun.oss.model.ObjectMetadata;
import com.aliyun.oss.model.PutObjectResult;
import com.shineyoo.manager.util.common.utils.IdGen;
import com.shineyoo.manager.util.common.utils.PropertiesLoader; /**
* @class:AliyunOSSClientUtil
* @descript:java使用阿里云OSS存储对象上传图片
* @date:2017年3月16日 下午5:58:08
* @author sang
*/
public class AliyunOSSClientUtil {
//log日志
private static Logger logger = LoggerFactory.getLogger(AliyunOSSClientUtil.class); private static PropertiesLoader loader = new PropertiesLoader("aliyunoss.properties");
//阿里云API的内或外网域名
private static String ENDPOINT;
//阿里云API的密钥Access Key ID
private static String ACCESS_KEY_ID;
//阿里云API的密钥Access Key Secret
private static String ACCESS_KEY_SECRET;
//阿里云API的bucket名称
private static String BACKET_NAME;
//阿里云API的文件夹名称
private static String FOLDER; //初始化属性
static{
ENDPOINT = loader.getProperty("ENDPOINT");
ACCESS_KEY_ID = loader.getProperty("ACCESS_KEY_ID");
ACCESS_KEY_SECRET = loader.getProperty("ACCESS_KEY_SECRET");
BACKET_NAME = loader.getProperty("BACKET_NAME");
FOLDER = loader.getProperty("FOLDER");
}
/**
* 获取配置
* @see
*/
public static String getConfig(String key) {
String value = loader.getProperty(key);
return value;
} /**
* 获取阿里云OSS客户端对象
* @return ossClient
*/
public static OSSClient getOSSClient(){
return new OSSClient(ENDPOINT,ACCESS_KEY_ID, ACCESS_KEY_SECRET);
} /**
* 创建存储空间
* @param ossClient OSS连接
* @param bucketName 存储空间
* @return
*/
public static String createBucketName(OSSClient ossClient,String bucketName){
//存储空间
final String bucketNames=bucketName;
if(!ossClient.doesBucketExist(bucketName)){
//创建存储空间
Bucket bucket=ossClient.createBucket(bucketName);
logger.info("创建存储空间成功");
return bucket.getName();
}
return bucketNames;
} /**
* 创建存储空间
* @param ossClient OSS连接
* @param bucketName 存储空间
* @return
*/
public static void putBucketACL(OSSClient ossClient,String bucketName){
//存储空间
final String bucketNames=bucketName;
System.out.println(ossClient.doesBucketExist(bucketName));
if(ossClient.doesBucketExist(bucketName)){
//修改存储空间的权限
ossClient.setBucketAcl(bucketNames, CannedAccessControlList.PublicRead);
logger.info("创建存储空间成功");
}
} /**
* 删除存储空间buckName
* @param ossClient oss对象
* @param bucketName 存储空间
*/
public static void deleteBucket(OSSClient ossClient, String bucketName){
ossClient.deleteBucket(bucketName);
logger.info("删除" + bucketName + "Bucket成功");
} /**
* 创建模拟文件夹
* @param ossClient oss连接
* @param bucketName 存储空间
* @param folder 模拟文件夹名如"qj_nanjing/"
* @return 文件夹名
*/
public static String createFolder(OSSClient ossClient,String bucketName,String folder){
//文件夹名
final String keySuffixWithSlash =folder;
//判断文件夹是否存在,不存在则创建
if(!ossClient.doesObjectExist(bucketName, keySuffixWithSlash)){
//创建文件夹
ossClient.putObject(bucketName, keySuffixWithSlash, new ByteArrayInputStream(new byte[0]));
logger.info("创建文件夹成功");
//得到文件夹名
OSSObject object = ossClient.getObject(bucketName, keySuffixWithSlash);
String fileDir=object.getKey();
return fileDir;
}
return keySuffixWithSlash;
} /**
* 根据key删除OSS服务器上的文件
* @param ossClient oss连接
* @param bucketName 存储空间
* @param folder 模拟文件夹名 如"qj_nanjing/"
* @param key Bucket下的文件的路径名+文件名 如:"upload/cake.jpg"
*/
public static void deleteFile(OSSClient ossClient, String bucketName, String folder, String key){
ossClient.deleteObject(bucketName, folder + key);
logger.info("删除" + bucketName + "下的文件" + folder + key + "成功");
}
/**
* 根据key删除OSS服务器上的文件
* @param key Bucket下的文件的路径名+文件名 如:"upload/cake.jpg"
*/
public static void deleteFile(String key){
OSSClient ossClient = getOSSClient();
ossClient.deleteObject(BACKET_NAME,key);
logger.info("删除" + BACKET_NAME + "下的文件" + key + "成功");
} /**
* 上传图片至OSS
* @param file 上传文件(文件全路径如:D:\\image\\cake.jpg)
* @return String 返回访问路径
* */
public static String uploadObject2OSS(File file) {
OSSClient ossClient = getOSSClient();
String resultStr = null;
String fileName = null;
try {
//以输入流的形式上传文件
InputStream is = new FileInputStream(file);
//文件名 如果出现重复,则重新生成名字,再上传
fileName = getfileName(file.getName());
if(ossClient.doesObjectExist(BACKET_NAME, FOLDER + fileName)){
fileName = getfileName(file.getName());
}
//文件大小
Long fileSize = file.length();
//创建上传Object的Metadata
ObjectMetadata metadata = new ObjectMetadata();
//上传的文件的长度
metadata.setContentLength(is.available());
//指定该Object被下载时的网页的缓存行为
metadata.setCacheControl("no-cache");
//指定该Object下设置Header
metadata.setHeader("Pragma", "no-cache");
//指定该Object被下载时的内容编码格式
metadata.setContentEncoding("utf-8");
//文件的MIME,定义文件的类型及网页编码,决定浏览器将以什么形式、什么编码读取文件。如果用户没有指定则根据Key或文件名的扩展名生成,
//如果没有扩展名则填默认值application/octet-stream
metadata.setContentType(getContentType(fileName));
//指定该Object被下载时的名称(指示MINME用户代理如何显示附加的文件,打开或下载,及文件名称)
metadata.setContentDisposition("filename/filesize=" + fileName + "/" + fileSize + "Byte.");
//上传文件 (上传文件流的形式)
PutObjectResult putResult = ossClient.putObject(BACKET_NAME, FOLDER + fileName, is, metadata);
resultStr = putResult.getETag();
logger.info("上传阿里云OSS服务器成功." +resultStr);
//解析结果
} catch (Exception e) {
e.printStackTrace();
logger.error("上传阿里云OSS服务器异常." + e.getMessage(), e);
}
return BACKET_NAME+"."+ENDPOINT+"/"+FOLDER + fileName;
}
/**
* 上传图片至OSS
* @param in 上传文件流
* @return String 返回访问路径,图片存储KEY
* */
public static String uploadObject2OSS(InputStream in,String name,Long size) {
OSSClient ossClient = getOSSClient();
String resultStr = null;
String fileName = null;
try {
//文件名 如果出现重复,则重新生成名字,再上传
fileName = getfileName(name);
if(ossClient.doesObjectExist(BACKET_NAME, FOLDER + fileName)){
fileName = getfileName(name);
}
//文件大小
Long fileSize = size;
//创建上传Object的Metadata
ObjectMetadata metadata = new ObjectMetadata();
//上传的文件的长度
metadata.setContentLength(in.available());
//指定该Object被下载时的网页的缓存行为
metadata.setCacheControl("no-cache");
//指定该Object下设置Header
metadata.setHeader("Pragma", "no-cache");
//指定该Object被下载时的内容编码格式
metadata.setContentEncoding("utf-8");
//文件的MIME,定义文件的类型及网页编码,决定浏览器将以什么形式、什么编码读取文件。如果用户没有指定则根据Key或文件名的扩展名生成,
//如果没有扩展名则填默认值application/octet-stream
metadata.setContentType(getContentType(fileName));
//指定该Object被下载时的名称(指示MINME用户代理如何显示附加的文件,打开或下载,及文件名称)
metadata.setContentDisposition("filename/filesize=" + fileName + "/" + fileSize + "Byte.");
//上传文件 (上传文件流的形式)
PutObjectResult putResult = ossClient.putObject(BACKET_NAME, FOLDER + fileName, in, metadata);
resultStr = putResult.getETag();
logger.info("上传阿里云OSS服务器成功." +resultStr);
//解析结果
} catch (Exception e) {
e.printStackTrace();
logger.error("上传阿里云OSS服务器异常." + e.getMessage(), e);
}
return BACKET_NAME+"."+ENDPOINT+"/"+FOLDER + fileName;
} /**
* 通过文件名判断并获取OSS服务文件上传时文件的contentType
* @param fileName 文件名
* @return 文件的contentType
*/
public static String getContentType(String fileName){
//文件的后缀名
String fileExtension = fileName.substring(fileName.lastIndexOf("."));
if(".bmp".equalsIgnoreCase(fileExtension)) {
return "image/bmp";
}
if(".gif".equalsIgnoreCase(fileExtension)) {
return "image/gif";
}
if(".jpeg".equalsIgnoreCase(fileExtension) || ".jpg".equalsIgnoreCase(fileExtension) || ".png".equalsIgnoreCase(fileExtension) ) {
return "image/jpeg";
}
if(".html".equalsIgnoreCase(fileExtension)) {
return "text/html";
}
if(".txt".equalsIgnoreCase(fileExtension)) {
return "text/plain";
}
if(".vsd".equalsIgnoreCase(fileExtension)) {
return "application/vnd.visio";
}
if(".ppt".equalsIgnoreCase(fileExtension) || "pptx".equalsIgnoreCase(fileExtension)) {
return "application/vnd.ms-powerpoint";
}
if(".doc".equalsIgnoreCase(fileExtension) || "docx".equalsIgnoreCase(fileExtension)) {
return "application/msword";
}
if(".xml".equalsIgnoreCase(fileExtension)) {
return "text/xml";
}
//默认返回类型
return "image/jpeg";
} /**
* 修改文件名
* @param fileName 文件名
* @return 文件的新名称
*/
public static String getfileName(String fileName){
String fileType = fileName.substring(fileName.lastIndexOf("."), fileName.length());
String name = IdGen.uuid()+fileType;
System.out.println(fileName+"----"+name);
return name; } //测试
public static void main(String[] args) throws Exception {
/* //上传文件
String f="D:\\tu\\21107201_230758751000-2.jpg";
File file=new File(f);
try{
String md5key = AliyunOSSClientUtil.uploadObject2OSS(file);
System.out.println("上传后的文件MD5数字唯一签名:" + md5key);
}catch(Exception e){
e.printStackTrace();
}*/ //初始化OSSClient
OSSClient ossClient=AliyunOSSClientUtil.getOSSClient();
//上传文件
String files="D:\\tu\\w1.png,D:\\tu\\w2.png,D:\\tu\\w3.png,D:\\tu\\w4.png,D:\\tu\\w5.png";
String[] file=files.split(",");
for(String filename:file){
//System.out.println("filename:"+filename);
File filess=new File(filename);
String md5key = AliyunOSSClientUtil.uploadObject2OSS(filess);
System.out.println("文件地址:" + md5key);
//上传后的文件MD5数字唯一签名:40F4131427068E08451D37F02021473A
}
} }
3. src/webapp/返回顶部 |
<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/webpage/include/taglib.jsp"%>
<%@ attribute name="name" type="java.lang.String" required="true" description="输入名称"%>
<%@ attribute name="files" type="java.util.List" required="false" description="文件集合"%>
<style>
.img-div {
position: relative;
display: inline-block;
}
.img-p{
position: absolute;
background: url("${ctxStatic}/common/img/close1.png");
top: 1px;
right: 11px;
z-index: 100;
width: 25px;
height: 25px;
background-size: 100%;
background-repeat: no-repeat;
}
</style>
<div class="lightBoxGallery">
<!-- 删除的delIds,后台接收并删除响应的资源 -->
<input type="hidden" name="delIds" id="delIds" value="">
<i class="layui-icon" style="font-size: 30px; color: #009688;cursor: pointer;" id="iconFile">+</i>
<input id="uploadFile1" type="file" multiple="multiple" onchange="upload.showImg(event)" name="${name}" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg" style="display: none"/>
<div id="filecontent">
<c:forEach items="${files}" var="file">
<div class="img-div">
<p class="img-p" style="right:3px!important" onclick="upload.delImg(this,'${file.url}')"></p>
<img src="${file.url}" style="height: 100px;width: 100px;">
</div>
</c:forEach>
</div>
</div>
<script type="text/javascript">
;var upload = {};!function(){
var _numIndex = 1;
$("#iconFile").click(function () {
debugger
$("#uploadFile"+ _numIndex).click();
});
/* $("#uploadFile"+ _numIndex).on("change",function(e){
debugger
var files = e.target.files;
if(files.length > 0){
$.each(files,function(index,file){
var img = new Image(), url = img.src = URL.createObjectURL(file);
img.width = "100";
img.height = "100";
img.style.paddingRight='10px';
img.style.paddingBottom='5px';
var _div = document.createElement("div");
_div.setAttribute("class","img-div");
var node = document.createElement("p");
node.setAttribute("class","img-p")
node.onclick=function(){
delImg(this)
}
_div.appendChild(node);
img.onload = function() {
URL.revokeObjectURL(url)
_div.appendChild(img)
$('#filecontent').append(_div)
}
});
debugger
//创建inputFile +1
var dom = $("#uploadFile" + _numIndex).clone().attr("id","uploadFile"+ (++_numIndex));
$("#filecontent").before(dom);
}
});
*/
upload.delImg = function(args,ids){
debugger
$(args).parents(".img-div").remove();
if(ids != null && ids != ""){
ids = ids.substring(ids.indexOf("image"));
}
var val = $("#delIds").val();
if(val != ""){
val += ","+ ids;
$("#delIds").val(val);
}else{
$("#delIds").val(ids);
}
}
upload.showImg = function(e){
e = e ||event;
var files = e.target.files;
if(files.length > 0){
$.each(files,function(index,file){
var img = new Image(), url = img.src = URL.createObjectURL(file);
img.width = "100";
img.height = "100";
img.style.paddingRight='10px';
img.style.paddingBottom='5px';
var _div = document.createElement("div");
_div.setAttribute("class","img-div");
var node = document.createElement("p");
node.setAttribute("class","img-p")
node.onclick=function(){
upload.delImg(this)
}
_div.appendChild(node);
img.onload = function() {
URL.revokeObjectURL(url)
_div.appendChild(img)
$('#filecontent').append(_div)
}
});
debugger
//创建inputFile +1
var input = document.createElement("input");
input.setAttribute("id","uploadFile"+ (++_numIndex));
input.setAttribute("type","file");
input.setAttribute("multiple","multiple");
input.setAttribute("name","${name}");
input.style.display = "none";
input.onchange=function(e){
upload.showImg(e);
}
$("#filecontent").before(input);
}
}
}(window);
</script>
<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/webpage/include/taglib.jsp"%>
<%@ attribute name="name" type="java.lang.String" required="true" description="输入名称"%>
<%@ attribute name="accept" type="java.lang.String" required="false" description="文件类型"%>
<%@ attribute name="echo" type="java.lang.String" required="false" description="文件回显"%>
<%@ attribute name="index" type="java.lang.String" required="false" description="下标"%>
<style>
.img-div {
position: relative;
display: inline-block;
}
.img-p{
position: absolute;
background: url("${ctxStatic}/common/img/close1.png");
top: 1px;
right: 11px;
z-index: 100;
width: 25px;
height: 25px;
background-size: 100%;
background-repeat: no-repeat;
}
</style>
<div class="lightBoxGallery">
<!-- 删除的delIds,后台接收并删除响应的资源 -->
<input type="hidden" name="delIds" id="delIds" value="">
<i class="layui-icon iconFile" style="font-size: 30px; color: #009688;cursor: pointer;" id="iconFile${index}">+</i>
<input class="uploadFile" id="uploadFile${index}" type="file" name="${name}" accept="${accept == null? 'image/gif,image/jpeg,image/jpg,image/png,image/svg':accept}" style="display: none"/>
<div id="filecontent" class="${index}">
<c:if test="${ not empty echo}">
<div class="img-div">
<p class="img-p" style="right:3px!important" onclick="singleUpload.delImg(this,'${echo}')"></p>
<img src="${echo}" style="height: 100px;width: 100px;">
</div>
</c:if>
</div>
</div>
<script type="text/javascript">
;var singleUpload = {};!function(){
$(".iconFile").unbind("click").click(function () {
$(this).next(".uploadFile").click();
});
$(".uploadFile").unbind("change").on("change",function(e){
debugger
var $this = $(this);
var files = e.target.files;
if(files.length > 0){
$.each(files,function(index,file){
if(file.type.indexOf("video") > -1){
$this.next("#filecontent").empty().append(file.name);
}else if(file.type.indexOf("pdf") > -1){
$this.next("#filecontent").empty().append(file.name);
}else{
var img = new Image(), url = img.src = URL.createObjectURL(file);
img.width = "100";
img.height = "100";
img.style.paddingRight='10px';
img.style.paddingBottom='5px';
var _div = document.createElement("div");
_div.setAttribute("class","img-div");
var node = document.createElement("p");
node.setAttribute("class","img-p")
node.onclick=function(){
singleUpload.delImg(this)
}
_div.appendChild(node);
img.onload = function() {
URL.revokeObjectURL(url)
_div.appendChild(img)
$this.next("#filecontent").empty().append(_div)
}
}
});
}
});
singleUpload.delImg = function (args,ids){
$(args).parents(".img-div").remove();
if(ids != null && ids != ""){
ids = ids.substring(ids.indexOf("image"));
var val = $(args).parents("#delIds").val();
ids = (val != null && val != "") ? (val + "," + ids) : ids;
$(args).parents("#delIds").val(ids);
}
}
}();
</script>
<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/webpage/include/taglib.jsp"%>
<%@ attribute name="name" type="java.lang.String" required="true" description="输入名称"%>
<%@ attribute name="accept" type="java.lang.String" required="false" description="文件类型"%>
<%@ attribute name="echo" type="java.lang.String" required="false" description="文件回显"%>
<style>
.img-div {
position: relative;
display: inline-block;
}
.img-p{
position: absolute;
background: url("${ctxStatic}/common/img/close1.png");
top: 1px;
right: 11px;
z-index: 100;
width: 25px;
height: 25px;
background-size: 100%;
background-repeat: no-repeat;
}
</style>
<div class="lightBoxGallery">
<!-- 删除的delIds,后台接收并删除响应的资源 -->
<input type="hidden" name="delIds" id="delIds" value="">
<i class="layui-icon" style="font-size: 30px; color: #009688;cursor: pointer;" id="iconFile">+</i>
<input id="uploadFile" type="file" name="${name}" accept="${accept == null? 'image/gif,image/jpeg,image/jpg,image/png,image/svg':accept}" style="display: none"/>
<div id="filecontent">
<c:if test="${ not empty echo}">
<div class="img-div">
<p class="img-p" style="right:3px!important" onclick="singleUpload.delImg(this,'${echo}')"></p>
<img src="${echo}" style="height: 100px;width: 100px;">
</div>
</c:if>
</div>
</div>
<script type="text/javascript">
;var singleUpload = {};!function(){
$("#iconFile").click(function () {
$("#uploadFile").click();
});
$("#uploadFile").on("change",function(e){
var files = e.target.files;
if(files.length > 0){
$.each(files,function(index,file){
var img = new Image(), url = img.src = URL.createObjectURL(file);
img.width = "100";
img.height = "100";
img.style.paddingRight='10px';
img.style.paddingBottom='5px';
var _div = document.createElement("div");
_div.setAttribute("class","img-div");
var node = document.createElement("p");
node.setAttribute("class","img-p")
node.onclick=function(){
singleUpload.delImg(this)
}
_div.appendChild(node);
img.onload = function() {
URL.revokeObjectURL(url)
_div.appendChild(img)
$('#filecontent').empty().append(_div)
}
});
}
});
singleUpload.delImg = function (args,ids){
$(args).parents(".img-div").remove();
if(ids != null && ids != ""){
ids = ids.substring(ids.indexOf("image"));
var val = $("#delIds").val();
ids = (val != null && val != "") ? (val + "," + ids) : ids;
$("#delIds").val(ids);
}
}
}();
</script>
4.返回顶部 |
ExtEntity.Java
java/com/manager/util/modules/
system/service/systemSlideService.java
@Transactional(readOnly = false)
public void save(SystemSlide systemSlide) { if(!systemSlide.getSingle().isEmpty()){
//获取文件
MultipartFile single = systemSlide.getSingle();
String name = single.getOriginalFilename();//文件名字
String key;
try {
key = AliyunOSSClientUtil.uploadObject2OSS(single.getInputStream(),name,single.getSize());
systemSlide.setSrc(key);
} catch (IOException e) {
e.printStackTrace();
}
}
super.save(systemSlide);
}
5.返回顶部 |
6.返回顶部 |
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |
IJ:ALI OSS 配置的更多相关文章
- Ali OSS 服务端签名并设置回调,客户端上传文件
一.最近做阿里云oss文件上传开发,一点收获分享给大家,帮助大家绕过一些坑.关于阿里云oss服务的介绍,我这里不做赘述了,可以查看阿里云OSS开发api文档. 在这里我主要介绍下,文件上传流程比较复杂 ...
- Ali OSS服务端签名直传并设置上传回调
服务端签名直传并设置上传回调 背景 请参考 Web端直传实践 里的背景介绍. 当采用服务端签名后直传方案后,问题来了,用户上传数据后,很多场景下,应用服务器都要知道用户上传了哪些文件,文件名字,甚至如 ...
- OSS网页上传和断点续传(OSS配置篇)
OSS网页上传和断点续传主要根据BrowserJS-SDK和相关文档整理而得,快速构建OSS上传应用 一.Bucket设置 浏览器中直接访问OSS需要开通Bucket的CORS设置 将allowed ...
- ALI OSS RequestTimeTooSkewed
php版阿里oss sdk,请求时抛RequestTimeTooSkewed错误,说时间差距太大,搜了一下发现是服务器的时间设置问题. 我们在安装完Centos Linux操作系统之后,点击系统的时间 ...
- IJ:工程配置Tomcat
ylbtech-IJ:工程配置Tomcat 1.返回顶部 1. 1.2. 1.3. 1.4. 2. 2.返回顶部 1. 2. 3.返回顶部 1. 2. 4.返回顶部 0.修改文件位置 D:\work- ...
- 昕有灵犀-xyFS私有文件云存储OSS服务
本工程为本人开发的开源项目,地址: https://gitee.com/475660/xyFS 介绍: 一站式企业私有文件服务.针对软件开发时提供的文件存储系统,对文件上传.下载.分类.分组.审计.统 ...
- aliyun oss操作汇总
// endpoint以杭州为例,其它region请按实际情况填写 String endpoint = "http://oss-cn-hangzhou.aliyuncs.com"; ...
- 阿里云对象存储 OSS 应用服务器搭建代码
背景说明 最近做一个APP客户端图片直传阿里云OSS的服务,需要在后台开一个阿里云的OSSToken获取的接口. 阿里云官方文档地址:快速搭建移动应用直传服务. 略过移动端说明,直接看服务端的. 不是 ...
- 从零搭建Spring Boot脚手架(7):整合OSS作为文件服务器
1. 前言 文件服务器是一个应用必要的组件之一.最早我搞过FTP,然后又用过FastDFS,接私活的时候我用MongoDB也凑合凑合.现如今时代不同了,开始流行起了OSS. Gitee: https: ...
随机推荐
- echarts通过ajax请求展示多叉树
背景:在sqlserver使用过程中经常由于各种原因会出现阻塞,并发数较高,很难肉眼看出那个session阻塞了其他process,通过sql查询出根源也需要大量的重复操作才能够找到. 因此就有这方面 ...
- C#——数据库的访问
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- (转)Java任务调度框架Quartz入门教程指南(四)Quartz任务调度框架之触发器精讲SimpleTrigger和CronTrigger、最详细的Cron表达式范例
http://blog.csdn.net/zixiao217/article/details/53075009 Quartz的主要接口类是Schedule.Job.Trigger,而触发器Trigge ...
- P1638 逛画展
题目描述 博览馆正在展出由世上最佳的 M 位画家所画的图画. wangjy想到博览馆去看这几位大师的作品. 可是,那里的博览馆有一个很奇怪的规定,就是在购买门票时必须说明两个数字, a和b,代表他要看 ...
- Yin and Yang Stones(思路题)
Problem Description: A mysterious circular arrangement of black stones and white stones has appeared ...
- php观察折模式
<?php class Paper{ private $_observers = array(); public function register($sub){ $this->_obse ...
- grep,cut,wc,sort,diff,uniq,patch命令
文本处理工具: Linux上文本处理三剑客: grep,egrep,fgrep: 文本过滤工具(模式: pattern)工具; grep:基本正则表达式,-E,-F egrep:扩展正则表达式,-G, ...
- hdu 5179 beautiful number
beautiful number 问题描述 令 A = \sum_{i=1}^{n}a_i * {10}^{n-i}(1\leq a_i \leq 9)A=∑i=1nai∗10n−i ...
- SFTP文件上传下载
http://www.cnblogs.com/longyg/archive/2012/06/25/2556576.html (转载)
- java 同时安装多版本问题
java 同时安装多版本问题(转) http://www.cnblogs.com/SamuelSun/p/6022296.html http://blog.csdn.net/u013256622/ar ...