Package org.apache.commons.fileupload.servlet

Examples of org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest()


            FileItemFactory factory = new DiskFileItemFactory(1048000, new File(System.getProperty("java.io.tmpdir")));
            ServletFileUpload upload = new ServletFileUpload(factory);
            upload.setSizeMax(-1);
            upload.setHeaderEncoding("UTF8");
            try {
                for (Iterator it = upload.parseRequest(request).iterator(); it.hasNext();) {
                    FileItem fi = (FileItem) it.next();
                    if (!fi.isFormField()) {
                        if (fi.getName() != null && fi.getName().length() > 0) {
                            tmpWar = new File(System.getProperty("java.io.tmpdir"), FilenameUtils.getName(fi.getName()));
                            fi.write(tmpWar);
View Full Code Here


    upload.setSizeMax(this.sizeMax);
    upload.setHeaderEncoding("UTF-8");

    Set<String> fileNames = new HashSet<String>();
    try {
      List<MonitoredDiskFileItem> items = upload.parseRequest(hRequest);
      long size;
      String fileName, extName;
      // 上传的路径
      File target = new File(this.isAbsolute ? this.uploadPath : hRequest
          .getSession().getServletContext().getRealPath(this.uploadPath));
View Full Code Here

    upload.setFileSizeMax(this.fileSizeMax);
    upload.setSizeMax(this.sizeMax);
    upload.setHeaderEncoding(charset);

    try {
      List<FileItem> items = upload.parseRequest(request);
      for (FileItem item : items) {
        if (item.isFormField()) {
          try {
            params
                .put(item.getFieldName(), item
View Full Code Here

  /** Constructor.  */
  public FileUploadWrapper(HttpServletRequest aRequest) throws IOException {
    super(aRequest);
    ServletFileUpload upload = new ServletFileUpload( new DiskFileItemFactory());
    try {
      List<FileItem> fileItems = upload.parseRequest(aRequest);
      convertToMaps(fileItems);
    }
    catch(FileUploadException ex){
      throw new IOException("Cannot parse underlying request: " + ex.toString());
    }
View Full Code Here

  public void parseRequestParameters(Map<String, String> params,
      Map<String, com.bradmcevoy.http.FileItem> files) throws RequestParseException {
        try {
            if (isMultiPart()) {
                ServletFileUpload upload = new ServletFileUpload();
                List<FileItem> items = upload.parseRequest(request);
                parseQueryString(params);
                for (FileItem item : items) {
                    if (item.isFormField()) {
                        params.put(item.getFieldName(), item.getString());
                    } else {
View Full Code Here

    FileItem imageFileFormField = null;
    try
    {
      FileItemFactory factory = new DiskFileItemFactory();
      ServletFileUpload upload = new ServletFileUpload(factory);
      List<?> items = upload.parseRequest(request);
      Iterator<?> iter = items.iterator();
      while(iter.hasNext())
      {
          item = (FileItem)iter.next();
          if(item.getFieldName().equals("file"))
View Full Code Here

        }
       
        Map<String,List<String>> tmpParams = new HashMap<String,List<String>>();
        Map<String,List<MultipartFile>> tmpFiles = new HashMap<String,List<MultipartFile>>();
       
        List<?> items = upload.parseRequest(request);
        for(Object itemObject: items){
            FileItem item = (FileItem)itemObject;
            if (item.isFormField()){
                List<String> list1 = tmpParams.get(item.getFieldName());
                if (list1 == null){
View Full Code Here

      Iterator iter = null;
      List items = null;
      ServletFileUpload upload = new ServletFileUpload( factory );
      ServletOutputStream out = null;
      try{
        items = upload.parseRequest( req );
        iter = items.iterator();
        res.setContentType( " text/xml");
        out = res.getOutputStream();
        out.println( " <response> " );
        while( iter.hasNext() ){
View Full Code Here

    try {
      HttpRequestHolder.setServletRequest(request);
      FileItemFactory factory = new DiskFileItemFactory();
      ServletFileUpload upload = new ServletFileUpload(factory);

      List<FileItem> items = upload.parseRequest(request);
      response.setContentType("text/xml");
      out = response.getOutputStream();
      for (FileItem item : items) {
        if (!item.isFormField()) {
          out.print("<resource");
View Full Code Here

        // Set overall request size constraint
        upload.setSizeMax(FileUploadConfig.getMaxFileSize());

        List<FileItem> fileItems = null;
        try {
            fileItems = upload.parseRequest(request);
        } catch (FileUploadException fue) {
            LOGGER.severe("File Upload Error", fue); //$NON-NLS-1$
            throw new Frame2Exception("File Upload Exception", fue); //$NON-NLS-1$
        }
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.