阿里云OSS文件下载

import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.ClientException;
import com.aliyun.oss.OSSException;
import com.fdc.home.dec.service.inter.domain.generation.DecPrice;
import com.fdc.home.dec.service.inter.domain.generation.DecPriceFiles;
import com.fdc.home.dec.service.inter.service.DecPriceFilesService;
import com.fdc.home.dec.service.inter.service.DecPriceService;
import com.fdc.home.dec.web.util.DownToZipUtil;
import com.fdc.home.dec.web.util.OSSUtils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
* 将文件夹下面的文件
* 打包成zip压缩文件
*
*/

@Controller
@RequestMapping(“file”)
public class FileBatchDwonloadController {

private static final Logger LOGGER = LoggerFactory
        .getLogger(FileBatchDwonloadController.class);

@Value("${bucketName}")
private String bucketName;

@Value("${aliImgPath}")
private String aliImgPath;

@Value("${aliImgUrl}")
private String aliImgUrl;



/**
 * 单个文件下载
 *
 * @param response
 * @param request
 * @throws OSSException
 * @throws ClientException
 * @throws IOException
 */
@RequestMapping("downLoadToFile")
@ResponseBody
public ModelAndView download(
        HttpServletResponse response, HttpServletRequest request) throws OSSException, ClientException, IOException {

// Map

你可能感兴趣的:(java操作阿里云OSS)