/**
* Upload a file into a container
*
* @return
* @throws IOException
* @throws ServiceException
* @throws CheckException
*/
@RequestMapping(value = "/container/{containerId}/application/{applicationName}", method = RequestMethod.POST, consumes = {
"multipart/form-data" })
@ResponseBody
@ResponseStatus(HttpStatus.OK)
public JsonResponse uploadFile(@PathVariable final String applicationName,
@RequestPart("file") MultipartFile fileUpload, @PathVariable final String containerId,
@RequestParam("path") String path, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServiceException, CheckException {
if (logger.isDebugEnabled()) {
logger.debug("-- CALL UPLOAD FILE TO CONTAINER FS --");
logger.debug("applicationName = " + applicationName);
logger.debug("containerId = " + containerId);
logger.debug("pathFile = " + path);
}
User user = authentificationUtils.getAuthentificatedUser();
Application application = applicationService.findByNameAndUser(user, applicationName);
// We must be sure there is no running action before starting new one
this.authentificationUtils.canStartNewAction(user, application, locale);
try {
// Application is now pending
applicationService.setStatus(application, Status.PENDING);
fileService.sendFileToContainer(containerId, path, fileUpload, null, null);
} finally {
// Application is always set to start
applicationService.setStatus(application, Status.START);
}
return new HttpOk();
}
FileController.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:devops-cstack
作者:
评论列表
文章目录