本文整理汇总了Java中org.springframework.web.multipart.MultipartHttpServletRequest.getParameter方法的典型用法代码示例。如果您正苦于以下问题:Java MultipartHttpServletRequest.getParameter方法的具体用法?Java MultipartHttpServletRequest.getParameter怎么用?Java MultipartHttpServletRequest.getParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.multipart.MultipartHttpServletRequest
的用法示例。
在下文中一共展示了MultipartHttpServletRequest.getParameter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateIndexImg
import org.springframework.web.multipart.MultipartHttpServletRequest; //导入方法依赖的package包/类
public void updateIndexImg(MultipartHttpServletRequest multipartReq, MarketApp marketApp) throws IOException,
MalformedURLException, URISyntaxException {
int id = marketApp.getId();
// 大游戏首页图片.浏览器上传用户本地文件 或 下载远端服务器 图片.
String indexImgUrlBak = multipartReq.getParameter("oldIndexImgUrl"); // app.getIndexImgUrl();
boolean needToDeleteIndexImgUrlBak = false;
String remoteIndexImgUrl = multipartReq.getParameter("remoteIndexImgUrl");
MultipartFile file = multipartReq.getFile("indexImgFile");
String subPath = null;
if (file != null && !file.isEmpty()) {
subPath = attachmentService.saveMarketAppFile(id, file);
} else if (StringUtils.isNotBlank(remoteIndexImgUrl)) {
// 拉取图片.
subPath = attachmentService.saveMarketAppFile(id, remoteIndexImgUrl);
}
if (StringUtils.isNotBlank(subPath)) {
String indexImgUrl = PathUtils.concate(appConfig.getDestBigGameUploadBaseurl(), subPath);
marketApp.setIndexImgUrl(indexImgUrl);
saveOrUpdate(marketApp);
needToDeleteIndexImgUrlBak = true;
}
if (appConfig.isDeleteUploadImageFile() && StringUtils.isNotBlank(indexImgUrlBak) && needToDeleteIndexImgUrlBak) {
attachmentService.deleteFile(indexImgUrlBak);
}
}
示例2: updateLogo
import org.springframework.web.multipart.MultipartHttpServletRequest; //导入方法依赖的package包/类
public void updateLogo(MultipartHttpServletRequest multipartReq, MarketApp marketApp) throws IOException,
MalformedURLException, URISyntaxException {
int id = marketApp.getId();
// logo. 浏览器上传用户本地文件 或 下载远端服务器 图片.
String logoUrlBak = multipartReq.getParameter("oldLogoUrl");// app.getLogoUrl();
boolean needToDeleteLogoUrlBak = false;
String remoteLogoUrl = multipartReq.getParameter("remoteLogoUrl");
MultipartFile file = multipartReq.getFile("logoFile");
String logoSubPath = null;
if (file != null && !file.isEmpty()) {
logoSubPath = attachmentService.saveMarketAppFile(id, file);
} else if (StringUtils.isNotBlank(remoteLogoUrl)) {
// 拉取图片.
logoSubPath = attachmentService.saveMarketAppFile(id, remoteLogoUrl);
}
if (StringUtils.isNotBlank(logoSubPath)) {
String logoUrl = PathUtils.concate(appConfig.getDestBigGameUploadBaseurl(), logoSubPath);
marketApp.setLogoUrl(logoUrl);
saveOrUpdate(marketApp);
needToDeleteLogoUrlBak = true;
}
if (appConfig.isDeleteUploadImageFile() && StringUtils.isNotBlank(logoUrlBak) && needToDeleteLogoUrlBak) {
attachmentService.deleteFile(logoUrlBak);
}
}
示例3: updateIndexImg
import org.springframework.web.multipart.MultipartHttpServletRequest; //导入方法依赖的package包/类
public void updateIndexImg(MultipartHttpServletRequest multipartReq, App app) throws IOException,
MalformedURLException, URISyntaxException {
int id = app.getId();
// 大游戏首页图片.浏览器上传用户本地文件 或 下载远端服务器 图片.
String indexImgUrlBak = multipartReq.getParameter("oldIndexImgUrl"); // app.getIndexImgUrl();
boolean needToDeleteIndexImgUrlBak = false;
String remoteIndexImgUrl = multipartReq.getParameter("remoteIndexImgUrl");
MultipartFile file = multipartReq.getFile("indexImgFile");
String subPath = null;
if (file != null && !file.isEmpty()) {
subPath = attachmentService.saveFile(id, file);
} else if (StringUtils.isNotBlank(remoteIndexImgUrl)) {
// 拉取图片.
subPath = attachmentService.saveFile(id, remoteIndexImgUrl);
}
if (StringUtils.isNotBlank(subPath)) {
String indexImgUrl = PathUtils.concate(appConfig.getDestUploadBaseurl(), subPath);
app.setIndexImgUrl(indexImgUrl);
saveOrUpdate(app);
needToDeleteIndexImgUrlBak = true;
}
if (StringUtils.isNotBlank(indexImgUrlBak) && needToDeleteIndexImgUrlBak) {
attachmentService.deleteFile(indexImgUrlBak);
}
}
示例4: upload
import org.springframework.web.multipart.MultipartHttpServletRequest; //导入方法依赖的package包/类
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public @ResponseBody JSONResponseBody upload(MultipartHttpServletRequest request) {
try {
String position = request.getParameter("position");
MultipartFile attachment = request.getFile("file");
if (attachment != null && attachment.getSize() > 0) {
FileMeta meta = new FileMeta();
meta.setId(request.getParameter("productId"));
meta.setName(IdUtils.uuid2());
meta.setSize(attachment.getSize());
meta.setExtension(StringUtils.getFilenameExtension(attachment.getOriginalFilename()));
meta.setBytes(attachment.getBytes());
meta.setUrl(Constants.DEPLOY_URL + Constants.PRODUCT_IMG_UPLOAD_DIR);
return new JSONResponseBody(productService.uploadImgBlock(meta, position));
}
} catch (Exception e) {
log.error(ExceptionUtils.getStackTraceAsString(e));
return new JSONResponseBody(false, e.getMessage());
}
return new JSONResponseBody();
}
示例5: uploadCenter
import org.springframework.web.multipart.MultipartHttpServletRequest; //导入方法依赖的package包/类
@RequestMapping(value = "/img/upload", method = RequestMethod.POST)
public @ResponseBody JSONResponseBody uploadCenter(MultipartHttpServletRequest request) {
try {
String position = request.getParameter("position");
MultipartFile attachment = request.getFile("file");
if (attachment != null && attachment.getSize() > 0) {
FileMeta meta = new FileMeta();
meta.setId(request.getParameter("productId"));
meta.setName(IdUtils.uuid2());
meta.setSize(attachment.getSize());
meta.setExtension(StringUtils.getFilenameExtension(attachment.getOriginalFilename()));
meta.setBytes(attachment.getBytes());
meta.setUrl(Constants.DEPLOY_URL + Constants.PRODUCT_IMG_UPLOAD_DIR);
return new JSONResponseBody(homeService.uploadImg(meta, position));
}
} catch (Exception e) {
log.error(ExceptionUtils.getStackTraceAsString(e));
return new JSONResponseBody(false, e.getMessage());
}
return new JSONResponseBody();
}
示例6: updateLogo
import org.springframework.web.multipart.MultipartHttpServletRequest; //导入方法依赖的package包/类
public void updateLogo(MultipartHttpServletRequest multipartReq, App app) throws IOException,
MalformedURLException, URISyntaxException {
int id = app.getId();
// logo. 浏览器上传用户本地文件 或 下载远端服务器 图片.
String logoUrlBak = multipartReq.getParameter("oldLogoUrl");// app.getLogoUrl();
boolean needToDeleteLogoUrlBak = false;
String remoteLogoUrl = multipartReq.getParameter("remoteLogoUrl");
MultipartFile file = multipartReq.getFile("logoFile");
String logoSubPath = null;
if (file != null && !file.isEmpty()) {
logoSubPath = attachmentService.saveFile(id, file);
} else if (StringUtils.isNotBlank(remoteLogoUrl)) {
// 拉取图片.
logoSubPath = attachmentService.saveFile(id, remoteLogoUrl);
}
if (StringUtils.isNotBlank(logoSubPath)) {
String logoUrl = PathUtils.concate(appConfig.getDestUploadBaseurl(), logoSubPath);
app.setLogoUrl(logoUrl);
saveOrUpdate(app);
needToDeleteLogoUrlBak = true;
}
if (StringUtils.isNotBlank(logoUrlBak) && needToDeleteLogoUrlBak) {
attachmentService.deleteFile(logoUrlBak);
}
appHistory4IndexDao.saveOrUpdate(app.getId());
}
示例7: insertRequestOffer
import org.springframework.web.multipart.MultipartHttpServletRequest; //导入方法依赖的package包/类
/**
* 지식정보제공/지식정보요청를 등록 처리 한다.
*
* @param requestOfferVO
*/
@RequestMapping(value = "/dam/spe/req/insertRequestOffer.do")
public String insertRequestOffer(
MultipartHttpServletRequest multiRequest,
@ModelAttribute RequestOfferVO requestOfferVO,
BindingResult bindingResult,
ModelMap model)
throws Exception {
// 서버 validate 체크
beanValidator.validate(requestOfferVO, bindingResult);
if (bindingResult.hasErrors()) {
return WebUtil.adjustViewName("/dam/spe/req/RequestOfferRegist");
}
// 첨부파일 관련 첨부파일ID 생성
requestOfferVO.setAtchFileId(fileUtil.insertMultiFile(multiRequest, "DSCH_"));
// 로그인 객체 선언
LoginVO loginVO = (LoginVO) UserDetailsHelper.getAuthenticatedUser();
requestOfferVO.setFrstRegisterId(loginVO.getUniqId());
// 지식전문가 일때
String sCmd = multiRequest.getParameter("cmd") == null ? "" : multiRequest.getParameter("cmd");
if (sCmd.equals("reply") ) {
if( requestOfferService.selectRequestOfferSpeCheck(loginVO.getUniqId())) {
requestOfferVO.setSpeId(loginVO.getUniqId());
requestOfferService.replyRequestOffer(requestOfferVO);
} else {
return WebUtil.adjustViewName("/dam/spe/req/RequestOfferRegist");
}
} else {
requestOfferVO.setEmplyrId(loginVO.getUniqId());
requestOfferService.insertRequestOffer(requestOfferVO);
}
model.addAttribute("message", MessageHelper.getMessage("success.common.insert"));
return WebUtil.redirectJsp(model, "/dam/spe/req/listRequestOffer.do");
}