resteasy上传单个文件/多个文件到阿里云服务器
代码如下:
ExcelServerController.java
package com.xgt.controller; import com.xgt.bean.bs.ExcelBean;
import com.xgt.common.BaseController;
import com.xgt.common.PcsResult;
import com.xgt.exception.EnumPcsServiceError;
import com.xgt.util.ConstantsUtil;
import com.xgt.util.MD5Util;
import com.xgt.util.OssUtil;
import org.apache.commons.io.IOUtils;
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
import org.springframework.stereotype.Controller; import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map; /**
* Created by Administrator on 2017/8/31.
* 上传Excel到服务器
*/
@Controller
@Path("/excelserver")
public class ExcelServerController extends BaseController{ @POST
@Path("/uploadExcel")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public PcsResult uploadExcel(MultipartFormDataInput input) {
try {
Map<String, List<InputPart>> uploadForm = input.getFormDataMap();
ExcelBean excelBean = convertMap(uploadForm);
uploadExcelFile(excelBean);
} catch (Exception e) {
e.printStackTrace();
PcsResult result = new PcsResult();
result.setCode(EnumPcsServiceError.ERROR_OPERATE.getCode()).setMessage(EnumPcsServiceError.ERROR_OPERATE.getDesc());
result.setSuccess(false);
return result;
}
return newResult(true);
} private void uploadExcelFile(ExcelBean excelBean) throws FileNotFoundException {
if(excelBean.getExcelPath().length>0){
// 上传到图片服务器
//这里是自己的服务器id,密码等关键信息
OssUtil oss=new OssUtil(accessKeyId, accessKeySecret, endpoint,bucketName);
//图片
String EXCELFileName = excelBean.getExcelPathName().substring(0,
excelBean.getExcelPathName().lastIndexOf(".")).toLowerCase();
EXCELFileName = MD5Util.MD5(EXCELFileName+System.currentTimeMillis());
String EXCELExtName = excelBean.getExcelPathName().substring(
excelBean.getExcelPathName().lastIndexOf("."), excelBean.getExcelPathName().length())
.toLowerCase();
oss.putObject(ConstantsUtil.Folder_EXCEL_CHART+ConstantsUtil.FILE_SEPARATOR
+EXCELFileName+EXCELExtName, excelBean.getExcelPath());
excelBean.setExcelPathName(ConstantsUtil.Folder_EXCEL_CHART+ConstantsUtil.FILE_SEPARATOR
+EXCELFileName+EXCELExtName);
}
} /**
* 数据摘取组装
* @param uploadForm
* @return
* @throws IOException
*/
private ExcelBean convertMap(Map<String, List<InputPart>> uploadForm) throws IOException {
ExcelBean excelBean=new ExcelBean();
if(uploadForm!=null) {
//普通实体类String属性inputPart.getBodyAsString()
//接收Integer类型,加一个Integer.parseInt(inputPart.getBodyAsString())即可
if (uploadForm.containsKey("excelPathName")) {
InputPart inputPart = uploadForm.get("excelPathName").get(0);
inputPart.setMediaType(MediaType.TEXT_PLAIN_TYPE);
excelBean.setExcelPathName(inputPart.getBodyAsString());
}
//***文件这么做,用输入流接收
if (uploadForm.containsKey("excelPath")) {
InputPart inputPart = uploadForm.get("excelPath").get(0);
MultivaluedMap<String, String> header = inputPart.getHeaders();
excelBean.setExcelPathName(getFileName(header));
InputStream inputStream = inputPart.getBody(InputStream.class, null);
excelBean.setExcelPath(IOUtils.toByteArray(inputStream));
} }
return excelBean;
} /**
* 返回文件名
* @param header
* @return
*/
private String getFileName(MultivaluedMap<String, String> header) {
String[] contentDisposition = header.getFirst("Content-Disposition").split(";");
for (String filename : contentDisposition) {
if ((filename.trim().startsWith("filename"))) {
String[] name = filename.split("=");
String finalFileName = name[1].trim().replaceAll("\"", "");
return finalFileName;
}
}
return "unknown";
} }
关键是获取到MultipartFormDataInput的map,解析成ExcelBean类型,并注入进去
BaseController.java
package com.xgt.common; import com.xgt.dao.entity.User;
import com.xgt.exception.EnumPcsServiceError;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Value; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import java.util.List; /**
* Base controller which contains common methods for other controllers.
*/
public class BaseController { @Value("${default.pageSize}")
private int defPageSize; @Value("${default.maxPageSize}")
private int defMaxPageSize; @Value("${aliyunOSS.accessKeyId}")
protected String accessKeyId; @Value("${aliyunOSS.accessKeySecret}")
protected String accessKeySecret; @Value("${aliyunOSS.uploadUrl}")
protected String endpoint; @Value("${aliyunOSS.bucketname}")
protected String bucketName; @Value("${aliyunOSS.imageAddress}")
protected String imageAddress; /**
* Generate new PcsResult object, default with "SUCCESS" code.
*
* @return PcsResult result.
*/
protected PcsResult newResult() {
PcsResult result = new PcsResult();
result.setCode(EnumPcsServiceError.SUCCESS.getCode()).setMessage(EnumPcsServiceError.SUCCESS.getDesc());
return result;
}
/**
* Generate new PcsResult object, default with "SUCCESS" code.
*
* @return PcsResult result.
*/
protected PcsResult newResult(Boolean success) {
PcsResult result = new PcsResult();
result.setSuccess(success);
result.setCode(EnumPcsServiceError.SUCCESS.getCode()).setMessage(EnumPcsServiceError.SUCCESS.getDesc()); return result;
} protected PcsResult failedResult(EnumPcsServiceError error) {
PcsResult result = new PcsResult();
result.setCode(error.getCode()).setMessage(error.getDesc());
return result;
} @SuppressWarnings("unused")
protected PcsResult validateFailedResult(Integer errorCode, String description) {
PcsResult result = new PcsResult();
result.setCode(errorCode).setMessage(description);
return result;
} @SuppressWarnings("unused")
protected PcsResult validateFailedResult(EnumPcsServiceError error) {
PcsResult result = new PcsResult();
result.setCode(error.getCode()).setMessage(error.getDesc());
return result;
} protected Integer getLoginUserId(){
User user = (User) SecurityUtils.getSubject().getPrincipal();
return user.getUserId();
} protected List<Integer> getDepartmentUserIdList(){
User user = (User) SecurityUtils.getSubject().getPrincipal();
return user.getDepartmentUserIdList();
} /**
* 构建 分页 页数
* @param page 页
* @return int
*/
protected int getCurPage(Integer page) {
if (page==null || page<1) {
return 1;
}
return page;
}
/**
* 构建 分页 每页显示条数
* @param pageSize 每页显示条数
* @return int
*/
protected int getPageSize(Integer pageSize) {
if (pageSize==null || pageSize<1) {
return defPageSize;
}
if (pageSize>defMaxPageSize) {
return defMaxPageSize;
}
return pageSize;
} }
工具类,少文件了可以留言
ConstantsUtil.java
package com.xgt.util; /**
* @author CC
* 常量工具类
* Created by CC on 2017/2/26.
*/
public class ConstantsUtil { public final static String FILE_SEPARATOR = "/"; public final static String CONDITIONSPLIT = "\\."; //订单大图
public final static String Folder_MAX_IMAGE="Order/Max";
//订单小图
public final static String Folder_MIN_IMAGE="Order/Min";
//人员身份证
public final static String Folder_IDCARD_IMAGE="Personnel/ID_Card";
//人员入职登记表
public final static String Folder_ENTRYFORM_IMAGE="Personnel/EntryForm";
//Excel路径
public final static String Folder_EXCEL_CHART="BaiSheng/Excel"; /**
* 订单相关附件类型常量
*/
public final static Integer TYPE_MIN_IMAGE=1; public final static Integer TYPE_MAX_IMAGE=2; }
OssUtil.java
package com.xgt.util; import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map; import javax.servlet.ServletContext; import com.aliyun.oss.OSSException; import org.apache.log4j.Logger; import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.CompleteMultipartUploadRequest;
import com.aliyun.oss.model.CompleteMultipartUploadResult;
import com.aliyun.oss.model.InitiateMultipartUploadRequest;
import com.aliyun.oss.model.InitiateMultipartUploadResult;
import com.aliyun.oss.model.ListObjectsRequest;
import com.aliyun.oss.model.OSSObject;
import com.aliyun.oss.model.OSSObjectSummary;
import com.aliyun.oss.model.ObjectListing;
import com.aliyun.oss.model.ObjectMetadata;
import com.aliyun.oss.model.PartETag;
import com.aliyun.oss.model.PutObjectResult;
import com.aliyun.oss.model.UploadPartRequest;
import com.aliyun.oss.model.UploadPartResult;
import org.springframework.beans.factory.annotation.Value; public class OssUtil {
private OSSClient client; private String accessKeyId; private String accessKeySecret; private String endpoint; private String bucketName; private Logger _logger = Logger.getLogger(OssUtil.class);
private Map<String, String> suffixMap = new HashMap<String, String>(); // 后缀名map public String getAccessKeyId() {
return accessKeyId;
} public void setAccessKeyId(String accessKeyId) {
this.accessKeyId = accessKeyId;
} public String getAccessKeySecret() {
return accessKeySecret;
} public void setAccessKeySecret(String accessKeySecret) {
this.accessKeySecret = accessKeySecret;
} public String getEndpoint() {
return endpoint;
} public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
} public String getBucketName() {
return bucketName;
} public void setBucketName(String bucketName) {
this.bucketName = bucketName;
} public OssUtil(String accessKeyId, String accessKeySecret, String endpoint,String bucketName) {
this.accessKeyId=accessKeyId;
this.accessKeySecret=accessKeySecret;
this.endpoint=endpoint;
this.bucketName=bucketName;
// 初始化一个OSSClient
this.client = new OSSClient(endpoint, accessKeyId, accessKeySecret);
suffixMap.put(".jpg", "image/jpg");
suffixMap.put(".gif", "image/gif");
suffixMap.put(".png", "image/png");
} public static void main(String[] args) {
/* ServletContext sc=null; ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
ModelManageService mms = (ModelManageService) ac.getBean("modelManageService"); OssUtils oss = new OssUtils(sc);
String accessKeyId = "gJzNJt7MhfihXs59";
String accessKeySecret = "jhGOCGbdzMIq7COPdSEITRcTdC7Z2n";
// 以杭州为例
String endpoint = "http://oss-cn-hangzhou.aliyuncs.com"; // 初始化一个OSSClient
oss.client = new OSSClient(endpoint, accessKeyId, accessKeySecret);
oss.bucketName="ypxgt-1";
try {
// oss.putObject("cc581", "images/aaaa/bbbb/ccc/logo.png",
// "D://logo.png");
// oss.listObjects("cc581");
List<YwOrderModel> modelList=mms.getModelList();
for(YwOrderModel model:modelList){
if(oss.isObjectExists(model.getMxlj00()+model.getMxmc00()+model.getMxkzm0())){
mms.updateModelUploadOss(model);
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
} /**
* 从这里去判断是通过普通上传还是分块上传
*
* @throws IOException
*/
public void uploadObject(String key, File file) throws IOException {
// 大于50M
if (file.length() / (1024 * 1024) >= 50) {
this.MultipartUpload(key, file);
} else {
this.putObject(key, file);
} } /**
* 简单上传文件
*
* @param bucketName
* 桶名
* @param key
* 文件名
* @param filePath
* 文件路径
* @throws FileNotFoundException
*/
public void putObject(String key, File file) throws FileNotFoundException { InputStream content = new FileInputStream(file);
// 创建上传Object的Metadata
ObjectMetadata meta = new ObjectMetadata();
// 必须设置ContentLength
meta.setContentLength(file.length()); String suffix = key.substring(key.lastIndexOf("."));
meta.setContentType(suffixMap.get(suffix)); // 上传Object.
PutObjectResult result = client.putObject(bucketName, key, content,
meta); // 打印ETag
_logger.info(file.getName() + "上传成功:" + result.getETag()); client.shutdown();
} /**
* 简单上传文件 * @param key
* 文件名
* @param file
* 字节文件
* @throws FileNotFoundException
*/
public void putObject(String key,byte[] file) throws FileNotFoundException {
// 上传Object.
PutObjectResult result = client.putObject(bucketName, key, new ByteArrayInputStream(file)); _logger.info("上传成功:" + result.getETag());
client.shutdown();
} /**
* 创建文件夹
*
* 桶名
* @param objectName
* 文件夹名,必须以"/"结尾
* @throws IOException
*/
public void createFolder(String objectName) throws IOException {
ObjectMetadata objectMeta = new ObjectMetadata();
/*
* 这里的size为0,注意OSS本身没有文件夹的概念,这里创建的文件夹本质上是一个size为0的Object,dataStream仍然可以有数据
*/
byte[] buffer = new byte[0];
ByteArrayInputStream in = new ByteArrayInputStream(buffer);
objectMeta.setContentLength(0);
try {
client.putObject(bucketName, objectName, in, objectMeta);
} finally {
in.close();
}
} /**
* 列出指定桶名里的所有Object
*
*/
public void listObjects() { // 获取指定bucket下的所有Object信息
ObjectListing listing = client.listObjects(bucketName); // 遍历所有Object
for (OSSObjectSummary objectSummary : listing.getObjectSummaries()) {
System.out.println(objectSummary.getKey());
}
} public void listFiles() {
// 构造ListObjectsRequest请求
ListObjectsRequest listObjectsRequest = new ListObjectsRequest(
bucketName); // List Objects
ObjectListing listing = client.listObjects(listObjectsRequest); // 遍历所有Object
System.out.println("Objects:");
for (OSSObjectSummary objectSummary : listing.getObjectSummaries()) {
System.out.println(objectSummary.getKey());
} // 遍历所有CommonPrefix
System.out.println("CommonPrefixs:");
for (String commonPrefix : listing.getCommonPrefixes()) {
System.out.println(commonPrefix);
}
} /**
* 删除指定文件
*
* @param key
*/
public void deleteObject(String key) {
client.deleteObject(bucketName, key);
} public File getObject(String key, String newFileName) throws IOException {
_logger.info("-------------------开始调用getObject方法");
_logger.info("key:" + key);
_logger.info("newFileName:" + newFileName);
// 获取Object,返回结果为OSSObject对象
OSSObject object = client.getObject(bucketName, key); // 获取ObjectMeta
ObjectMetadata meta = object.getObjectMetadata(); // 获取Object的输入流
InputStream objectContent = object.getObjectContent(); File file = new File(newFileName);
if (!file.exists()) { File dir = new File(newFileName.substring(0,
newFileName.lastIndexOf("\\"))); if (!dir.exists()) {
dir.mkdirs();
} file.createNewFile(); OutputStream out = new FileOutputStream(newFileName);
byte[] bytes = new byte[objectContent.available()];
while ((objectContent.read(bytes)) != -1) {
out.write(bytes);
bytes = new byte[objectContent.available()];
} objectContent.close();
out.close();
// 关闭流
// objectContent.close();
return file;
}
return file;
} public void MultipartUpload(String key, File partFile) throws IOException { // 开始Multipart Upload
InitiateMultipartUploadRequest initiateMultipartUploadRequest = new InitiateMultipartUploadRequest(
bucketName, key);
InitiateMultipartUploadResult initiateMultipartUploadResult = client
.initiateMultipartUpload(initiateMultipartUploadRequest);
// 打印UploadId
System.out.println("UploadId: "
+ initiateMultipartUploadResult.getUploadId());
// 设置每块为 10M
final int partSize = 1024 * 1024 * 10;
// 计算分块数目
int partCount = (int) (partFile.length() / partSize);
if (partFile.length() % partSize != 0) {
partCount++;
}
// 新建一个List保存每个分块上传后的ETag和PartNumber
List<PartETag> partETags = new ArrayList<PartETag>();
for (int i = 0; i < partCount; i++) {
// 获取文件流
FileInputStream fis = new FileInputStream(partFile);
// 跳到每个分块的开头
long skipBytes = partSize * i;
fis.skip(skipBytes);
// 计算每个分块的大小
long size = partSize < partFile.length() - skipBytes ? partSize
: partFile.length() - skipBytes;
// 创建UploadPartRequest,上传分块
UploadPartRequest uploadPartRequest = new UploadPartRequest();
uploadPartRequest.setBucketName(bucketName);
uploadPartRequest.setKey(key);
uploadPartRequest.setUploadId(initiateMultipartUploadResult
.getUploadId());
uploadPartRequest.setInputStream(fis);
uploadPartRequest.setPartSize(size);
uploadPartRequest.setPartNumber(i + 1);
UploadPartResult uploadPartResult = client
.uploadPart(uploadPartRequest);
// 将返回的PartETag保存到List中。
partETags.add(uploadPartResult.getPartETag());
// 关闭文件 fis.close();
}
CompleteMultipartUploadRequest completeMultipartUploadRequest = new CompleteMultipartUploadRequest(
bucketName, key, initiateMultipartUploadResult.getUploadId(),
partETags); // 完成分块上传
CompleteMultipartUploadResult completeMultipartUploadResult = client
.completeMultipartUpload(completeMultipartUploadRequest); // 打印Object的ETag
System.out.println(completeMultipartUploadResult.getETag());
} /**
* 获取dir下所有的文件
*
* @param dir
* @return
*/
public List<OSSObjectSummary> getFileLstInDir(String dir) {
// 构造ListObjectsRequest请求
ListObjectsRequest listObjectsRequest = new ListObjectsRequest(
bucketName); // "/" 为文件夹的分隔符
listObjectsRequest.setDelimiter("/"); // 列出fun目录下的所有文件和文件夹
listObjectsRequest.setPrefix(dir + "/"); ObjectListing listing = client.listObjects(listObjectsRequest); return listing.getObjectSummaries();
} /**
* 判断OSS上是否有key为keyName的Object
*
* @param keyName
* @return
*/
public boolean isObjectExists(String keyName) {
// 获取Object,返回结果为OSSObject对象
try {
OSSObject object = client.getObject(bucketName, keyName);
if (object != null) {
return true;
}
} catch (OSSException e) {
return false;
}
return false;
} /**
* 从OSS上下载CKT文件至本地并打包上传至OSS上
*
* @param wjjPath
* @param localPath
* @throws Exception
*/
public void cktZip(String wjjPath, String localPath) throws Exception {
_logger.info("wjjPath:" + wjjPath);
_logger.info("localPath:" + localPath); // 获取OSS目录下参考图的List
List<OSSObjectSummary> fileList = getFileLstInDir(wjjPath);
_logger.info(fileList.size()); if (fileList == null || fileList.size() == 0) {
return;
} File cktDir = new File(localPath + wjjPath);
_logger.info(cktDir.getName());
if (!cktDir.exists()) {
cktDir.mkdirs();
} for (OSSObjectSummary ossObject : fileList) {
String fileName = ossObject.getKey();
_logger.info("fileName:" + fileName);
// 将OSS的文件取回本地,为下一步压缩ZIP包作准备
getObject(fileName, localPath + fileName.replaceAll("/", "\\\\"));
}
ZipUtils zipUtils = new ZipUtils();
_logger.info("need zip's dirName:" + localPath + wjjPath);
zipUtils.compress(localPath + wjjPath);
File zipFile = new File(localPath + wjjPath.replaceAll("/", "\\\\")
+ ".zip");
_logger.info("压缩后的文件名:" + localPath + wjjPath.replaceAll("/", "\\\\")
+ ".zip");
putObject(wjjPath + ".zip", zipFile);
if (zipFile.exists()) {
zipFile.delete();
}
} }
MD5Util.java
package com.xgt.util; import java.security.MessageDigest;
import java.util.Random; public class MD5Util {
public final static String MD5(String s) {
char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F'};
try {
byte[] btInput = s.getBytes();
// 获得MD5摘要算法的 MessageDigest 对象
MessageDigest mdInst = MessageDigest.getInstance("MD5");
// 使用指定的字节更新摘要
mdInst.update(btInput);
// 获得密文
byte[] md = mdInst.digest();
// 把密文转换成十六进制的字符串形式
int j = md.length;
char str[] = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++) {
byte byte0 = md[i];
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
str[k++] = hexDigits[byte0 & 0xf];
}
return new String(str);
} catch (Exception e) {
e.printStackTrace();
return null;
}
} public static String toMD5(byte[] source) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(source);
StringBuffer buf = new StringBuffer();
for (byte b : md.digest())
buf.append(String.format("%02x", b & 0xff));
return buf.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
} public static String getRandomPassword(int pwd_len) {
// 35是因为数组是从0开始的,26个字母+10个数字
final int maxNum = 10;
int i; // 生成的随机数
int count = 0; // 生成的密码的长度
// char[] str = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
// 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
// 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
char[] str = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; StringBuffer pwd = new StringBuffer("");
Random r = new Random();
while (count < pwd_len) {
// 生成随机数,取绝对值,防止生成负数, i = Math.abs(r.nextInt(maxNum)); // 生成的数最大为36-1 if (i >= 0 && i < str.length) {
pwd.append(str[i]);
count++;
}
} return pwd.toString();
} public static void main(String[] args) {
}
}
resteasy上传单个文件/多个文件到阿里云服务器的更多相关文章
- JavaScript进阶(九)JS实现本地文件上传至阿里云服务器
JS实现本地文件上传至阿里云服务器 前言 在前面的博客< JavaScript进阶(八)JS实现图片预览并导入服务器功能>(点击查看详情)中,实现了JS将本地图片文件预览并上传至阿里云服务 ...
- 上传文件到Ubuntu阿里云服务器(windows到Linux的文件上传)
上传文件到Ubuntu阿里云服务器(windows到Linux的文件上传) 最近在阿里云上面租了一个轻量级服务器玩玩,学习学习怎么在服务器部署网站.然后嘞,在想要将本地文件上传到服务器的时候,自己研究 ...
- 结合阿里云服务器,使用FTP上传和下载文件,出现的问题和解决方案
一.FTP出现的问题 二.在网上找的方案 如果使用FileZilla默认设置连接ftp服务器的话可能会报以下错误: 错误: 无法建立数据连接:ECONNREFUSED - Connection ref ...
- 阿里云服务器(Windows)如何下载文件
背景:公司只有我一个技术,在我之前还有一个老技术,属于兼职状态,为了尽快熟悉公司网站及app项目情况,我联系了老技术,请他尽快将代码发给我,他说代码文件过大,问我能不能连上服务器下载.百度了很多,都不 ...
- windows如何向阿里云服务器传递文件
一,前提说明 最近搞了一个阿里云服务器玩玩,打算自己搞一个小网站什么的. 然后再阿里云上花9.9买了半年的服务器. 服务器版本是 ubuntu_16_04. 二.目标是往阿里云服务器上上传本地文件. ...
- 阿里云服务器+ftp文件操作+基于Centos7的vsftpd配置
路径问题:一定要注意此位置是否需要加入"/" 文件上传方式:被动模式 vsftp完整配置: # # The default compiled in settings are fai ...
- Window、Ubuntu传输文件到阿里云服务器
Ubuntu传输文件到阿里云服务器 scp -r file(ubuntu的文件) root(用户名)@xx.xx.xx.xx(公网ip):/home/(目标文件夹) Window传输文件到阿里云服务器 ...
- 在阿里云服务器(ECS)上从零开始搭建nginx服务器
本文介绍了如何在阿里云服务器上从零开始搭建nginx服务器.阿里云服务器(ECS)相信大家都不陌生,感兴趣的同学可以到http://www.aliyun.com/product/ecs去购买,或到体验 ...
- Wordpress上传到阿里云服务器
Wordpress上传到阿里云服务器 登录服务器 https://account.aliyun.com/login/login.htm 绑定域名 获取FTP信息.数据库信息 在本地修改wordpres ...
- 【UEditor】 UEditor整合项目上传资源到阿里云服务器
目录 关于此文 下载源码 JSP代码 Java代码 阿里云jar包引入配置 成功啦! 回到顶部 关于此文 项目中要实现编辑器生成带格式的html文档,存入模板,最后生成html的URL,所以选择了UE ...
随机推荐
- 在 LINQ to Entities 查询中无法构造实体或复杂类型“Mvc_MusicShop_diy.Models.Order”
错误代码: var orders = db.Orders.Where(o => o.UserId == userid).Select(c => new Order { OrderI ...
- Entity Framework 高性能 泛型缓存+动态Lambda
前言:自学CSharp挺长时间的了,这是我第一编博客,跟大家分享一下.如有不足地方请多多包涵,也欢迎大家提出更好的意见,下面开始进入正题. 一.泛型缓存 1.概念:1.泛型(泛型也是一种推断类型,从而 ...
- Qt keyPressEvent keyReleaseEvent 分析
最近使用Qt时,在增加一个按下某键(M),临时显示图层,键(M)弹起时隐藏图层的功能时,碰到了一些问题: keyPressEvent 事件不响应 这个问题,网上搜到的结果是可能是控件没获取焦点,比如Q ...
- mongodb 搭建集群(分片+副本集)
mongodb 搭建集群(分片+副本集) 一.搭建结构图: 二.搭建步骤:
- [Maven实战-许晓斌]-[第二章]-2.5 Eclipse上面安装Maven插件 m2eclipse
Eclipse上面安装Maven插件 m2eclipse --需要特别指出的是,越来越多的最新的Eclipse版本自带Maven m2e http://m2eclipse.sonatype.org/s ...
- IE9以下不支持placeholder属性
jquery.placeholder.min.js 这个js可以去这个网站搜索https://www.bootcdn.cn/jquery-placeholder/ 使用这个jquery.placeho ...
- [ActionSprit 3.0] FMS客户端调用服务器端命令或方法
有时候客户端需要和服务器端进行通信,服务器端会有个main.asc文件(当然,文件名可以自己定义),这个就是服务器端程序,是在服务器上执行的,你可以用trace调试,trace的内容会在管理服务器的页 ...
- [转] HTTP状态码错误代码
一些常见的状态码为: 200 - 服务器成功返回网页 404 - 请求的网页不存在 503 - 服务不可用 详细分解: 1xx(临时响应) 表示临时响应并需要请求者继续执行操作的状态代码. 代码 说明 ...
- java处理excel-xlsx格式大文件的解决方案
1.第一次读取7M左右的ecxel文件,使用poi 库实现,参考了下面的博文. http://www.cnblogs.com/chenfool/p/3632642.html 使用上面的方法在 下面Wo ...
- supervisor 使用
cat /etc/supervisord.conf https://www.cnblogs.com/yuzhoushenqi/p/6825204.html http://127.0.0.1:1001/ ...