Java Code Examples for org.apache.commons.fileupload.FileUpload#setSizeMax()

The following examples show how to use org.apache.commons.fileupload.FileUpload#setSizeMax() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommonsFileUploadSupport.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Determine an appropriate FileUpload instance for the given encoding.
 * <p>Default implementation returns the shared FileUpload instance
 * if the encoding matches, else creates a new FileUpload instance
 * with the same configuration other than the desired encoding.
 * @param encoding the character encoding to use
 * @return an appropriate FileUpload instance.
 */
protected FileUpload prepareFileUpload(@Nullable String encoding) {
	FileUpload fileUpload = getFileUpload();
	FileUpload actualFileUpload = fileUpload;

	// Use new temporary FileUpload instance if the request specifies
	// its own encoding that does not match the default encoding.
	if (encoding != null && !encoding.equals(fileUpload.getHeaderEncoding())) {
		actualFileUpload = newFileUpload(getFileItemFactory());
		actualFileUpload.setSizeMax(fileUpload.getSizeMax());
		actualFileUpload.setFileSizeMax(fileUpload.getFileSizeMax());
		actualFileUpload.setHeaderEncoding(encoding);
	}

	return actualFileUpload;
}
 
Example 2
Source File: CommonsFileUploadSupport.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Determine an appropriate FileUpload instance for the given encoding.
 * <p>Default implementation returns the shared FileUpload instance
 * if the encoding matches, else creates a new FileUpload instance
 * with the same configuration other than the desired encoding.
 * @param encoding the character encoding to use
 * @return an appropriate FileUpload instance.
 */
protected FileUpload prepareFileUpload(@Nullable String encoding) {
	FileUpload fileUpload = getFileUpload();
	FileUpload actualFileUpload = fileUpload;

	// Use new temporary FileUpload instance if the request specifies
	// its own encoding that does not match the default encoding.
	if (encoding != null && !encoding.equals(fileUpload.getHeaderEncoding())) {
		actualFileUpload = newFileUpload(getFileItemFactory());
		actualFileUpload.setSizeMax(fileUpload.getSizeMax());
		actualFileUpload.setFileSizeMax(fileUpload.getFileSizeMax());
		actualFileUpload.setHeaderEncoding(encoding);
	}

	return actualFileUpload;
}
 
Example 3
Source File: CommonsFileUploadSupport.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Determine an appropriate FileUpload instance for the given encoding.
 * <p>Default implementation returns the shared FileUpload instance
 * if the encoding matches, else creates a new FileUpload instance
 * with the same configuration other than the desired encoding.
 * @param encoding the character encoding to use
 * @return an appropriate FileUpload instance.
 */
protected FileUpload prepareFileUpload(String encoding) {
	FileUpload fileUpload = getFileUpload();
	FileUpload actualFileUpload = fileUpload;

	// Use new temporary FileUpload instance if the request specifies
	// its own encoding that does not match the default encoding.
	if (encoding != null && !encoding.equals(fileUpload.getHeaderEncoding())) {
		actualFileUpload = newFileUpload(getFileItemFactory());
		actualFileUpload.setSizeMax(fileUpload.getSizeMax());
		actualFileUpload.setFileSizeMax(fileUpload.getFileSizeMax());
		actualFileUpload.setHeaderEncoding(encoding);
	}

	return actualFileUpload;
}
 
Example 4
Source File: CommonsFileUploadSupport.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Determine an appropriate FileUpload instance for the given encoding.
 * <p>Default implementation returns the shared FileUpload instance
 * if the encoding matches, else creates a new FileUpload instance
 * with the same configuration other than the desired encoding.
 * @param encoding the character encoding to use
 * @return an appropriate FileUpload instance.
 */
protected FileUpload prepareFileUpload(String encoding) {
	FileUpload fileUpload = getFileUpload();
	FileUpload actualFileUpload = fileUpload;

	// Use new temporary FileUpload instance if the request specifies
	// its own encoding that does not match the default encoding.
	if (encoding != null && !encoding.equals(fileUpload.getHeaderEncoding())) {
		actualFileUpload = newFileUpload(getFileItemFactory());
		actualFileUpload.setSizeMax(fileUpload.getSizeMax());
		actualFileUpload.setFileSizeMax(fileUpload.getFileSizeMax());
		actualFileUpload.setHeaderEncoding(encoding);
	}

	return actualFileUpload;
}