Examples of UploadStatus


Examples of com.denisk.appengine.nl.shared.UploadStatus

            parentKey = value;
          } else if(KIND_FIELD.equals(fieldName)){
            kind = value;
          } else if(fieldName.startsWith(UploadStatus.FLAG_PREFIX)){
            String name = fieldName.substring(UploadStatus.FLAG_PREFIX.length());
            UploadStatus status = UploadStatus.valueOf(UploadStatus.class, value);
            uploadStatuses.put(name, status);
          } else {
            regularProperties.put(fieldName, value);
          }
        } else {
          System.out.println("File field " + fieldName
              + " with file name " + item.getName()
              + " detected.");
          byte[] content = IOUtils.toByteArray(stream);
          uploadContents.put(fieldName, new ByteArrayHolder(content));
        }
      }
    } catch (FileUploadException e) {
      throw new ServletException(e);
    }
    Entity entity;
   
    if(key == null || key.isEmpty()){
      //create new
      entity = dh.createEntity(kind, parentKey, regularProperties);
    } else {
      //update existing
      entity = dh.find(key);
      dh.setProperties(entity, regularProperties);
      dh.save(entity);
    }

    for(String blobField: uploadStatuses.keySet()){
      UploadStatus status = uploadStatuses.get(blobField);
      switch(status){
      case DELETE:
        if(entity == null){
          throw new IllegalArgumentException("Attempt to delete blob " + blobField + " of entity that does not exist, key = " + key);
        }
View Full Code Here

Examples of helma.framework.UploadStatus

    protected UploadStatus createUpload(String uploadId) {
        if (uploads == null) {
            uploads = new HashMap();
        }
        UploadStatus status = new UploadStatus();
        uploads.put(uploadId, status);
        return status;
    }
View Full Code Here

Examples of helma.framework.UploadStatus

    protected void pruneUploads() {
        if (uploads == null || uploads.isEmpty())
            return;
        for (Iterator it = uploads.values().iterator(); it.hasNext();) {
            UploadStatus status = (UploadStatus) it.next();
            if (status.isDisposable()) {
                it.remove();
            }
        }
    }
View Full Code Here

Examples of org.jasig.portal.UploadStatus

        }

        //Do multipart file upload request processing
        if (ServletFileUpload.isMultipartContent(new ServletRequestContext(request))) {
            //Used to communicate to clients of multipart data if the request processing worked correctly
            UploadStatus uploadStatus;
           
            final String encoding = this.determineEncoding(request);
            final FileUpload fileUpload = this.prepareFileUpload(encoding);
            try {
                final List<FileItem> fileItems = ((ServletFileUpload) fileUpload).parseRequest(request);
                final MultipartParsingResult parsingResult = parseFileItems(fileItems, encoding);
               
                final Map<String, MultipartDataSource[]> multipartDataSources = this.getMultipartDataSources(parsingResult);
                channelParameters.putAll(multipartDataSources);
               
                final Map<String, String[]> multipartParameters = parsingResult.getMultipartParameters();
                channelParameters.putAll(multipartParameters);
               
                uploadStatus = new UploadStatus(UploadStatus.SUCCESS, this.getFileUpload().getFileSizeMax());
            }
            catch (FileUploadException fue) {
                this.logger.warn("Failed to parse multipart upload, processing will continue but not all parameters may be available.", fue);
                uploadStatus = new UploadStatus(UploadStatus.FAILURE, this.getFileUpload().getFileSizeMax());
                ExceptionHelper.genericTopHandler(Errors.bug, fue);
            }
           
            channelParameters.put(UPLOAD_STATUS, new UploadStatus[] { uploadStatus });
        }
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.