001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.upload;
016    
017    import com.liferay.portal.kernel.util.ProgressTracker;
018    
019    import java.util.List;
020    
021    import javax.servlet.http.HttpServletRequest;
022    import javax.servlet.http.HttpSession;
023    
024    import org.apache.commons.fileupload.FileItem;
025    import org.apache.commons.fileupload.FileItemFactory;
026    import org.apache.commons.fileupload.FileUploadException;
027    import org.apache.commons.fileupload.servlet.ServletFileUpload;
028    
029    /**
030     * @author     Brian Myunghun Kim
031     * @author     Brian Wing Shun Chan
032     * @deprecated As of 7.0.0, with no direct replacement
033     */
034    @Deprecated
035    public class LiferayFileUpload extends ServletFileUpload {
036    
037            public static final String FILE_NAME =
038                    LiferayFileUpload.class.getName() + "_FILE_NAME";
039    
040            public static final String PERCENT = ProgressTracker.PERCENT;
041    
042            public LiferayFileUpload(
043                    FileItemFactory fileItemFactory, HttpServletRequest request) {
044    
045                    super(fileItemFactory);
046    
047                    _session = request.getSession();
048            }
049    
050            @Override
051            public List<FileItem> parseRequest(HttpServletRequest request)
052                    throws FileUploadException {
053    
054                    _session.removeAttribute(LiferayFileUpload.PERCENT);
055    
056                    return super.parseRequest(request);
057            }
058    
059            private final HttpSession _session;
060    
061    }