code: protected void parseRequest(HttpServletRequest request,
                                  HttpServletResponse response) {
          requestParams = new HashMap<String, Object>();
          listFiles = new ArrayList<FileItemStream>();
          listFileStreams = new ArrayList<ByteArrayOutputStream>();
  
          // Parse the request
          if (ServletFileUpload.isMultipartContent(request)) {
              // multipart request
              try {
                  ServletFileUpload upload = new ServletFileUpload();
                  FileItemIterator iter = upload.getItemIterator(request);
                  while (iter.hasNext()) {
                      FileItemStream item = iter.next();
                      String name = item.getFieldName();
                      InputStream stream = item.openStream();
                      if (item.isFormField()) {
                          requestParams.put(name,
                                            Streams.asString(stream));
                      } else {
                          String fileName = item.getName();
                          if (fileName != null && !"".equals(fileName.trim())) {
                              listFiles.add(item);
  
                              ByteArrayOutputStream os = new ByteArrayOutputStream();
                              IOUtils.copy(stream,
                                           os);
                              listFileStreams.add(os);
                          }
                      }
                  }
              } catch (Exception e) {
                  logger.error("Unexpected error parsing multipart content",
                               e);
              }
          } else {
              // not a multipart
              for (Object mapKey : request.getParameterMap().keySet()) {
                  String mapKeyString = (String) mapKey;
  
                  if (mapKeyString.endsWith("[]")) {
                      // multiple values
                      String values[] = request.getParameterValues(mapKeyString);
                      List<String> listeValues = new ArrayList<String>();
                      for (String value : values) {
                          listeValues.add(value);
                      }
                      requestParams.put(mapKeyString,
                                        listeValues);
                  } else {
                      // single value
                      String value = request.getParameter(mapKeyString);
                      requestParams.put(mapKeyString,
                                        value);
                  }
              }
          }
      }
docs: Parse request parameters and files.
  @param request
  @param response