| @@ -8,9 +8,7 @@ import com.amazonaws.auth.AWSCredentialsProvider; | |||||
| import com.amazonaws.auth.BasicAWSCredentials; | import com.amazonaws.auth.BasicAWSCredentials; | ||||
| import com.amazonaws.services.s3.AmazonS3; | import com.amazonaws.services.s3.AmazonS3; | ||||
| import com.amazonaws.services.s3.AmazonS3ClientBuilder; | import com.amazonaws.services.s3.AmazonS3ClientBuilder; | ||||
| import com.amazonaws.services.s3.model.CannedAccessControlList; | |||||
| import com.amazonaws.services.s3.model.ObjectMetadata; | |||||
| import com.amazonaws.services.s3.model.PutObjectRequest; | |||||
| import com.amazonaws.services.s3.model.*; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.config.AwsProperty; | import com.iformall.config.AwsProperty; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| @@ -24,10 +22,7 @@ import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RequestParam; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||
| import java.io.*; | import java.io.*; | ||||
| @@ -288,4 +283,28 @@ public class UploadController extends BaseController { | |||||
| return data; | return data; | ||||
| } | } | ||||
| /** | |||||
| * AWS | |||||
| * @return | |||||
| * @throws Exception | |||||
| */ | |||||
| @GetMapping(value = "/lists") | |||||
| @ApiOperation("aws列举文件") | |||||
| public ResultData awsList() throws Exception { | |||||
| logger.info("[" + getIpAddr() + "] UploadController::cimgUpload"); | |||||
| try{ | |||||
| ObjectListing ol = s3.listObjects(awsProperty.getBucketName()); | |||||
| List<S3ObjectSummary> objects = ol.getObjectSummaries(); | |||||
| for (S3ObjectSummary os: objects) { | |||||
| logger.info(os.toString()); | |||||
| break; | |||||
| } | |||||
| }catch (Exception e){ | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| } | } | ||||