Package org.apache.commons.fileupload.disk

Examples of org.apache.commons.fileupload.disk.DiskFileItemFactory


    protected List parseUploads(ServletRequestContext reqcx, RequestTrans reqtrans,
                                final UploadStatus uploadStatus, String encoding)
            throws FileUploadException, UnsupportedEncodingException {
        // handle file upload
        DiskFileItemFactory factory = new DiskFileItemFactory();
        FileUpload upload = new FileUpload(factory);
        // use upload limit for individual file size, but also set a limit on overall size
        upload.setFileSizeMax(uploadLimit * 1024);
        upload.setSizeMax(totalUploadLimit * 1024);

 
View Full Code Here


            boolean discard = false;

            //
            // parse multipart request and extract the file
            //
            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();) {
View Full Code Here

public class FileUploadWrapper extends HttpServletRequestWrapper {
 
  /** 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){
View Full Code Here

    FileItem item = null;
    String comment = null;
    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())
      {
View Full Code Here

            parameters.put(param.getKey(), new String[]{param.getValue()});
        }
    }
   
    public void parseRequest() throws FileUploadException{
        DiskFileItemFactory factory = new DiskFileItemFactory();
        if (maxMemorySize > 0){
            factory.setSizeThreshold(maxMemorySize);
        }
        if (tempDirectory != null){
            File tmpDir = new File(tempDirectory);
            if (tmpDir.exists() && tmpDir.isDirectory()){
                factory.setRepository(tmpDir);
            }
        }
        ServletFileUpload upload = new ServletFileUpload(factory);
        if (maxFileSize > 0){
            upload.setFileSizeMax(maxFileSize);
View Full Code Here

    public void doPost( HttpServletRequest req, HttpServletResponse res ){

      File disk = null;
      FileItem item = null;
      FileItemFactory factory = new DiskFileItemFactory();
      Iterator iter = null;
      List items = null;
      ServletFileUpload upload = new ServletFileUpload( factory );
      ServletOutputStream out = null;
      try{
View Full Code Here

    ServletOutputStream out = null;

    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();
View Full Code Here

  public static Map<String, Object> processMultipartRequest(final HttpServletRequest request)
            throws Frame2Exception {
        Map<String, Object> parameters = new HashMap<String, Object>();

        // Create a factory for disk-based file items
        DiskFileItemFactory factory = new DiskFileItemFactory();

        // Set factory constraints
        factory.setSizeThreshold(FileUploadConfig.getBufferSize());
        factory.setRepository(new File(FileUploadConfig.getFileTempDir()));
       
        // Create a new file upload handler
        ServletFileUpload upload = new ServletFileUpload(factory);

        // Set overall request size constraint
View Full Code Here

    // TODO: This method is not used and should be removed. amb
    public static String uploadAndStoreImage(HttpServletRequest request, String idField, String uploadField) {
        //Delegator delegator = (Delegator) request.getAttribute("delegator");

        //String idFieldValue = null;
        ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
        List<FileItem> lst = null;
        Locale locale = UtilHttp.getLocale(request);

        try {
            lst = UtilGenerics.checkList(fu.parseRequest(request));
View Full Code Here

        Map<String, FileItem> files = null;
        Map<String, String> fields = null;
        if(actionRequest.getContentType() != null && actionRequest.getContentType().startsWith("multipart/form-data")) {
            files = new HashMap<String, FileItem>();
            fields = new HashMap<String, String>();
            PortletFileUpload request = new PortletFileUpload(new DiskFileItemFactory());
            try {
                List<FileItem> items = request.parseRequest(actionRequest);
                for (FileItem item : items) {
                    if (item.isFormField()) {
                        if (item.getFieldName().equals(MODE_KEY)) {
View Full Code Here

TOP

Related Classes of org.apache.commons.fileupload.disk.DiskFileItemFactory

Copyright © 2018 www.massapicom. 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.