Examples of UploadedFile


Examples of br.com.caelum.vraptor.observer.upload.UploadedFile

  public void testIfUploadedFileIsConverted() {
    when(request.getAttribute("myfile")).thenReturn(file);
   
    UploadedFileConverter converter = new UploadedFileConverter(request);
   
    UploadedFile uploadedFile = converter.convert("myfile", UploadedFile.class);
    assertEquals(file, uploadedFile);
  }
View Full Code Here

Examples of br.com.objectos.comuns.web.upload.UploadedFile

    UploadedForm form = request.getUploadedForm();
    UploadCtx ctx = new UploadCtx(baseUrl, form, session, uploadServer);

    if (hasFiles && !hasErrors) {
      UploadedFile file = files.get(0);
      ctx = ctx.withFile(file);
      return new FirstFromRequestValid(ctx, file);
    } else {
      List<UploadRequestException> exceptions = closure.getExceptions();
      return new FirstFromRequestInvalid(ctx, exceptions);
View Full Code Here

Examples of com.ibm.xsp.component.UIFileuploadEx.UploadedFile

    public boolean save(FacesContext context, boolean force) throws FacesExceptionEx {
        DataContainer container = getDataContainer();
        if(container instanceof Container){
            DataAccessor accessor = ((Container)container).getDataAccessor();
            if(accessor instanceof FileServiceAccessor){
                UploadedFile uploadedFile = (UploadedFile)((FileServiceAccessor)accessor).getUploadedFile();
                if(uploadedFile != null){
                    IUploadedFile file = uploadedFile.getUploadedFile();
                    HashMap<String, String> params = new HashMap<String, String>();
                    String filename = uploadedFile.getFilename();
                    params.put("file", filename);

                    if (null != file) {
                        File serverFile = file.getServerFile();
                        if (null != serverFile) {
View Full Code Here

Examples of com.ibm.xsp.component.UIFileuploadEx.UploadedFile

         * @param uploadedFileObj the uploadedFile to set
         * @throws CloneNotSupportedException
         */
        public void setUploadedFile(Object uploadedFileObj) throws CloneNotSupportedException {
            if (uploadedFileObj instanceof UploadedFile) {
                UploadedFile uploadedFile = (UploadedFile) uploadedFileObj;
                this.uploadedFile = uploadedFile;
            }
        }
View Full Code Here

Examples of com.ibm.xsp.http.UploadedFile

  public String checkForUpload(String clientId) {
    try {

      HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
      UploadedFile fileData =  (UploadedFile) request.getParameterMap().get(clientId);

      if (fileData != null) {
        return getUpload(fileData);
      }
    } catch (Exception e) {
View Full Code Here

Examples of com.isfasiel.util.file.UploadedFile

    Map<Object, Object> model = new HashMap<Object, Object>();
    if (exception instanceof MaxUploadSizeExceededException)
    {
      model.put("errors", exception.getMessage());
      model.put("fileList", "'empty'");
      model.put("uploadedFile", new UploadedFile());
      return new ModelAndView("file/upload", (Map)model);
    } else {
      exception.printStackTrace();
      return null;
      //model.put("errors", "Unexpected error: " + exception.getMessage());
View Full Code Here

Examples of com.liferay.faces.bridge.model.UploadedFile

        "fileId");

    try {
      List<UploadedFile> uploadedFiles = applicantModelBean.getUploadedFiles();

      UploadedFile uploadedFileToDelete = null;

      for (UploadedFile uploadedFile : uploadedFiles) {

        if (uploadedFile.getId().equals(fileId)) {
          uploadedFileToDelete = uploadedFile;

          break;
        }
      }

      if (uploadedFileToDelete != null) {
        File file = new File(uploadedFileToDelete.getAbsolutePath());
        file.delete();
        uploadedFiles.remove(uploadedFileToDelete);
        logger.debug("Deleted file=[{0}]", file);
      }
    }
View Full Code Here

Examples of com.liferay.faces.util.model.UploadedFile

    String fileId = (String) uiCommand.getValue();

    try {
      List<UploadedFile> uploadedFiles = applicantModelBean.getUploadedFiles();

      UploadedFile uploadedFileToDelete = null;

      for (UploadedFile uploadedFile : uploadedFiles) {

        if (uploadedFile.getId().equals(fileId)) {
          uploadedFileToDelete = uploadedFile;

          break;
        }
      }

      if (uploadedFileToDelete != null) {
        uploadedFileToDelete.delete();
        uploadedFiles.remove(uploadedFileToDelete);
        logger.debug("Deleted file=[{0}]", uploadedFileToDelete.getName());
      }
    }
    catch (Exception e) {
      logger.error(e);
    }
View Full Code Here

Examples of com.sun.rave.web.ui.model.UploadedFile

    public String buttonRefresh_action() {
        return null;
    }
   
    public String buttonUpload_action() {
        UploadedFile uploadedFile = fileUpload.getUploadedFile();
        DocumentFileManager documentFileManager =
                new DocumentFileManager(uploadedFile.getOriginalName(),
                getClientPath());
        String justFileName = documentFileManager.getFileName();
        String uploadedFileType = uploadedFile.getContentType();
       
        //default name of document
        String doc  ;
        if (title.getText() == null ||
                ((String) title.getText()).trim().length() == 0) {
            doc = documentFileManager.getTitle();
        } else {
            doc = ((String) title.getText()).trim();
        }
       
        try {
            File file = new File(documentFileManager
                    .getFilenameOnServer(getServerPath()));
            if (!documentFileManager.isMatchingClientPath()) {
                uploadedFile.write(file);
                info("Uploaded file originally named '" +
                        uploadedFile.getOriginalName() + "' writed to " +
                        documentFileManager.getFilenameOnServer(getServerPath()));
            }
            // Persist the doc ref
            this.document.setContact(getContact());
            this.document.setDocumentLink(justFileName);
            this.document.setTitle(doc);
            this.document.setDocumentType(uploadedFileType);
            this.document = new DocumentController().update(this.document);
            getContact().getDocumentLinks().add(this.document);
            new ContactController().update(
                    getContact());
            title.setText("");
           
        } catch (Exception ex) {
            error("Cannot upload file: " + uploadedFile.getOriginalName() + " to " +
                    documentFileManager.getFilenameOnServer(getServerPath()) +
                    "(" + ex.getClass().getName() + " msg: " + ex.getMessage() + ").");
        }
       
        list.refreshListContact();
View Full Code Here

Examples of com.sun.rave.web.ui.model.UploadedFile

    public String buttonRefresh_action() {
        return null;
    }
   
    public String buttonUpload_action() {
        UploadedFile uploadedFile = fileUpload.getUploadedFile();
        DocumentFileManager documentFileManager =
                new DocumentFileManager(uploadedFile.getOriginalName(),
                getClientPath());
        String justFileName = documentFileManager.getFileName();
        String uploadedFileType = uploadedFile.getContentType();
       
        //default name of document
        String doc  ;
        if (title.getText() == null ||
                ((String) title.getText()).trim().length() == 0) {
            doc = documentFileManager.getTitle();
        } else {
            doc = ((String) title.getText()).trim();
        }
       
        try {
            File file = new File(documentFileManager
                    .getFilenameOnServer(getServerPath()));
            if (!documentFileManager.isMatchingClientPath()) {
                uploadedFile.write(file);
                info("Uploaded file originally named '" +
                        uploadedFile.getOriginalName() + "' writed to " +
                        documentFileManager.getFilenameOnServer(getServerPath()));
            }
            // Persist the doc ref
            this.document.setContact(getContact());
            this.document.setDocumentLink(justFileName);
            this.document.setTitle(doc);
            this.document.setDocumentType(uploadedFileType);
            this.document = new DocumentController().update(this.document);
            getContact().getDocumentLinks().add(this.document);
            new ContactController().update(
                    getContact());
            title.setText("");
           
        } catch (Exception ex) {
            error("Cannot upload file: " + uploadedFile.getOriginalName() + " to " +
                    documentFileManager.getFilenameOnServer(getServerPath()) +
                    "(" + ex.getClass().getName() + " msg: " + ex.getMessage() + ").");
        }
       
        list.refreshListContact();
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.