Examples of MultipartFile


Examples of org.springframework.web.multipart.MultipartFile

           
               Map filemap = multipartRequest.getFileMap();
           
               for (Object name : filemap.keySet()) {
               
                   MultipartFile mpf = (MultipartFile) filemap.get(name);
                   String orgFilename = mpf.getOriginalFilename();
                   String contentType = mpf.getContentType();
                   InputStream is = mpf.getInputStream();
   
                   Content content = new Content((String) name, orgFilename, contentType, is);
                   is.close();
                   sb.append(content + "\r\n");
               }
View Full Code Here

Examples of org.springframework.web.multipart.MultipartFile

           
               Map filemap = multipartRequest.getFileMap();
           
               for (Object name : filemap.keySet()) {
               
                   MultipartFile mpf = (MultipartFile) filemap.get(name);
                   String orgFilename = mpf.getOriginalFilename();
                   String contentType = mpf.getContentType();
                   InputStream is = mpf.getInputStream();
   
                   Content content = new Content((String) name, orgFilename, contentType, is);
                   is.close();
                   sb.append(content + "\r\n");
               }
View Full Code Here

Examples of org.springframework.web.multipart.MultipartFile

    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "import/omdl")
    public RpcResult<Page> importPage(HttpServletRequest request, final HttpServletResponse response,
            @RequestParam final String pageName) {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        final MultipartFile multipartFile = multipartRequest.getFile("omdlFile");
        return new RpcOperation<Page>() {
             @Override
             public Page execute() {
               return omdlService.importOmdl(multipartFile, pageName);
             }
View Full Code Here

Examples of org.springframework.web.multipart.MultipartFile

    }

    protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
        FileUploadForm form = (FileUploadForm) command;
        String uploadDir = form.getUploadDir();
        MultipartFile file = form.getFile();
       
        file.transferTo(new File(uploadDir + File.separator + file.getOriginalFilename()));
       
        return new AjaxModelAndView(this.getSuccessView(), errors);
    }
View Full Code Here

Examples of org.springframework.web.multipart.MultipartFile

      HttpServletResponse response, Object command, BindException errors)
      throws Exception {
    Context dspaceContext = UIUtil.obtainContext(request);

    ImportDTO object = (ImportDTO) command;
    MultipartFile fileDTO = object.getFile();

    // read folder from configuration and make dir
    String path = ConfigurationManager
        .getProperty(CrisConstants.CFG_MODULE,"researcherpage.file.import.path");
    File dir = new File(path);
    dir.mkdir();
    try {
      if (object.getModeXSD() != null) {
        response.setContentType("application/xml;charset=UTF-8");
        response.addHeader("Content-Disposition",
            "attachment; filename=rp.xsd");
        String nameXSD = "xsd-download-webuirequest.xsd";
        File filexsd = new File(dir, nameXSD);
        filexsd.createNewFile();
        ImportExportUtils.newGenerateXSD(response.getWriter(), dir, applicationService
            .findAllContainables(RPPropertiesDefinition.class), filexsd, new String[]{"crisobjects","crisobject"}, "rp:", "http://www.cilea.it/researcherpage/schemas", "http://www.cilea.it/researcherpage/schemas", new String[]{"publicID","uuid","businessID","type"}, new boolean[]{false,false,true,true});
        response.getWriter().flush();
        response.getWriter().close();
        return null;
      } else {
        if (fileDTO != null && !fileDTO.getOriginalFilename().isEmpty()) {
          Boolean defaultStatus = ConfigurationManager
              .getBooleanProperty(CrisConstants.CFG_MODULE,"researcherpage.file.import.rpdefaultstatus");
          if (AuthorizeManager.isAdmin(dspaceContext)) {
            dspaceContext.turnOffAuthorisationSystem();
          }
          ImportExportUtils.importResearchersXML(fileDTO.getInputStream(), dir,
              applicationService, dspaceContext, defaultStatus);
          saveMessage(
              request,
              getText("action.import.with.success",
                  request.getLocale()));
View Full Code Here

Examples of org.springframework.web.multipart.MultipartFile

      HttpServletResponse response, Object command, BindException errors)
      throws Exception {
    Context dspaceContext = UIUtil.obtainContext(request);

    ImportDTO object = (ImportDTO) command;
    MultipartFile fileDTO = object.getFile();

    // read folder from configuration and make dir
    String path = ConfigurationManager
        .getProperty(CrisConstants.CFG_MODULE,"researcherpage.file.import.path");
    File dir = new File(path);
    dir.mkdir();
    try {
      if (object.getModeXSD() != null) {
        response.setContentType("application/xml;charset=UTF-8");
        response.addHeader("Content-Disposition",
            "attachment; filename=rp.xsd");
        String nameXSD = "xsd-download-webuirequest.xsd";
        File filexsd = new File(dir, nameXSD);
        filexsd.createNewFile()
        ImportExportUtils.generateXSD(response.getWriter(), dir, applicationService
                        .findAllContainables(RPPropertiesDefinition.class), filexsd, null);
        response.getWriter().flush();
        response.getWriter().close();
        return null;
      } else {
        if (fileDTO != null && !fileDTO.getOriginalFilename().isEmpty()) {
          Boolean defaultStatus = ConfigurationManager
              .getBooleanProperty(CrisConstants.CFG_MODULE,"researcherpage.file.import.rpdefaultstatus");
          if (AuthorizeManager.isAdmin(dspaceContext)) {
            dspaceContext.turnOffAuthorisationSystem();
          }
          ImportExportUtils.importResearchersXML(fileDTO.getInputStream(), dir,
              applicationService, dspaceContext, defaultStatus);
          saveMessage(
              request,
              getText("action.import.with.success",
                  request.getLocale()));
View Full Code Here

Examples of org.springframework.web.multipart.MultipartFile

  }

  @RequestMapping(value = "upload")
  public void upload(HttpServletRequest request, HttpServletResponse response) {
    MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
    MultipartFile thumbnail = multipartRequest.getFile("image");
    byte[] imgBy = null;
    try {
      imgBy = thumbnail.getBytes();
    } catch (IOException e1) {
      e1.printStackTrace();
    }
    FileSystem fSystem = new FileSystem();
    fSystem.setBasePath("static");
View Full Code Here

Examples of org.springframework.web.multipart.MultipartFile

    } else {
      strThumnailFullPath = m_strServerThumbnailPath;             
    }

    MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
    MultipartFile mpFile = multipartRequest.getFile("attachFile");

    // 파일 사이즈 체크 (모두 허용 - web 단에서 체크함)   
    // 파일 확장자 체크 (모두 허용 - web 단에서 체크함)

    // 파일 이름을 사용자 아이디로 변경한다.
    String strUserIdFileName = strId + ".jpg";   // id.jpg

    long lngFileSize = mpFile.getSize();
    String strFileType = mpFile.getContentType();

    // 업로드
    int intRet = FileUpDownUtil.fileUpload(lngFileSize, mpFile.getInputStream(), strThumnailFullPath, strUserIdFileName);

    if (intRet == -1) {
      response.getWriter().append("{success:false, fileSize:" + lngFileSize + "}");
    } else if (intRet == -2) {
      response.getWriter().append("{success:false, fileSize:0}");
View Full Code Here

Examples of org.springframework.web.multipart.MultipartFile

  //@ResponseBody 컴포넌트가 application/json 타입을 지원하지않으므로 text/html 타입으로 json을 리턴한다.
  public void fileUploadAdd(@PathVariable String bbsId, HttpServletRequest request, HttpServletResponse response) throws IOException {

    MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;

    MultipartFile mpFile = multipartRequest.getFile("attachFile");

    // 파일 사이즈 체크 (모두 허용 - web 단에서 체크함)   
    // 파일 확장자 체크 (모두 허용 - web 단에서 체크함)
    // 파일의 기초정보
    String strUniqueFileName = UUID.randomUUID() + "_" + mpFile.getOriginalFilename();
    long lngFileSize = mpFile.getSize();
    String strFileType = mpFile.getContentType();

    String strFilePath;      // TEMP 디렉토리의 파일경로
    if (System.getProperty("os.name").contains("Windows")) {
      strFilePath = m_strLocalUploadPathTemp + m_SEPARATOR + bbsId;
    } else {
      strFilePath = m_strServerUploadPathTemp + m_SEPARATOR + bbsId;
    }   
   
    // 업로드
    int intRet = FileUpDownUtil.fileUpload(lngFileSize, mpFile.getInputStream(), strFilePath, strUniqueFileName);
   
    if (intRet == -1) {
      response.getWriter().append("{success:false, fileSize:" + lngFileSize + "}");
    } else if (intRet == -2) {
      response.getWriter().append("{success:false, fileSize:0}");
View Full Code Here

Examples of org.springframework.web.multipart.MultipartFile

    Boolean value = parameterMap.getBoolean("bogus", Boolean.TRUE);
    assertEquals(Boolean.TRUE, value);
  }

  public void testGetMultipart() {
    MultipartFile file = parameterMap.getMultipartFile("multipartFile");
    assertNotNull(file);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.