All Downloads are FREE. Search and download functionalities are using the official Maven repository.

in.clouthink.daas.fss.util.HttpMultipartUtils Maven / Gradle / Ivy

There is a newer version: 3.0.7
Show newest version
package in.clouthink.daas.fss.util;

import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.servlet.http.HttpServletRequest;
import java.util.Iterator;

/**
* @author dz
 */
public abstract class HttpMultipartUtils {

	public static MultipartFile resolveMultipartFile(HttpServletRequest request) {
		if (!(request instanceof MultipartHttpServletRequest)) {
			return null;
		}

		MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
		Iterator it = multipartRequest.getFileNames();
		if (it == null || !it.hasNext()) {
			return null;
		}

		return multipartRequest.getFile(it.next());
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy