Class DefaultHttpDataFactory
java.lang.Object
io.netty.handler.codec.http.multipart.DefaultHttpDataFactory
- All Implemented Interfaces:
HttpDataFactory
Default factory giving
Attribute and FileUpload according to constructor.
According to the constructor, Attribute and FileUpload can be:
- MemoryAttribute, DiskAttribute or MixedAttribute
- MemoryFileUpload, DiskFileUpload or MixedFileUpload
for (InterfaceHttpData httpData: decoder.getBodyHttpDatas()) {
httpData.release();
factory.removeHttpDataFromClean(request, httpData);
}
factory.cleanAllHttpData();
decoder.destroy();
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHttpData will be in memory if less than default size (16KB).DefaultHttpDataFactory(boolean useDisk) HttpData will be always on Disk if useDisk is True, else always in Memory if FalseDefaultHttpDataFactory(boolean useDisk, Charset charset) DefaultHttpDataFactory(long minSize) HttpData will be on Disk if the size of the file is greater than minSize, else it will be in memory.DefaultHttpDataFactory(long minSize, Charset charset) DefaultHttpDataFactory(Charset charset) -
Method Summary
Modifier and TypeMethodDescriptionvoidRemove all InterfaceHttpData from virtual File storage from clean list for all requestsvoidvoidcleanRequestHttpData(HttpRequest request) Remove all InterfaceHttpData from virtual File storage from clean list for the requestvoidcleanRequestHttpDatas(HttpRequest request) createAttribute(HttpRequest request, String name) createAttribute(HttpRequest request, String name, long definedSize) createAttribute(HttpRequest request, String name, String value) createFileUpload(HttpRequest request, String name, String filename, String contentType, String contentTransferEncoding, Charset charset, long size) voidremoveHttpDataFromClean(HttpRequest request, InterfaceHttpData data) Remove the given InterfaceHttpData from clean list (will not delete the file, except if the file is still a temporary one as setup at construction)voidsetBaseDir(String baseDir) Override globalDiskAttribute.baseDirectoryandDiskFileUpload.baseDirectoryvalues.voidsetDeleteOnExit(boolean deleteOnExit) Override globalDiskAttribute.deleteOnExitTemporaryFileandDiskFileUpload.deleteOnExitTemporaryFilevalues.voidsetMaxLimit(long maxSize) To set a max size limitation on fields.
-
Field Details
-
MINSIZE
public static final long MINSIZEProposed default MINSIZE as 16 KB.- See Also:
-
MAXSIZE
public static final long MAXSIZEProposed default MAXSIZE = -1 as UNLIMITED- See Also:
-
-
Constructor Details
-
DefaultHttpDataFactory
public DefaultHttpDataFactory()HttpData will be in memory if less than default size (16KB). The type will be Mixed. -
DefaultHttpDataFactory
-
DefaultHttpDataFactory
public DefaultHttpDataFactory(boolean useDisk) HttpData will be always on Disk if useDisk is True, else always in Memory if False -
DefaultHttpDataFactory
-
DefaultHttpDataFactory
public DefaultHttpDataFactory(long minSize) HttpData will be on Disk if the size of the file is greater than minSize, else it will be in memory. The type will be Mixed. -
DefaultHttpDataFactory
-
-
Method Details
-
setBaseDir
Override globalDiskAttribute.baseDirectoryandDiskFileUpload.baseDirectoryvalues.- Parameters:
baseDir- directory path where to store disk attributes and file uploads.
-
setDeleteOnExit
public void setDeleteOnExit(boolean deleteOnExit) Override globalDiskAttribute.deleteOnExitTemporaryFileandDiskFileUpload.deleteOnExitTemporaryFilevalues.- Parameters:
deleteOnExit- true if temporary files should be deleted with the JVM, false otherwise.
-
setMaxLimit
public void setMaxLimit(long maxSize) Description copied from interface:HttpDataFactoryTo set a max size limitation on fields. Exceeding it will generate an ErrorDataDecoderException. A value of -1 means no limitation (default).- Specified by:
setMaxLimitin interfaceHttpDataFactory
-
createAttribute
- Specified by:
createAttributein interfaceHttpDataFactory- Parameters:
request- associated request- Returns:
- a new Attribute with no value
-
createAttribute
- Specified by:
createAttributein interfaceHttpDataFactory- Parameters:
request- associated requestname- name of the attributedefinedSize- defined size from request for this attribute- Returns:
- a new Attribute with no value
-
createAttribute
- Specified by:
createAttributein interfaceHttpDataFactory- Parameters:
request- associated request- Returns:
- a new Attribute
-
createFileUpload
public FileUpload createFileUpload(HttpRequest request, String name, String filename, String contentType, String contentTransferEncoding, Charset charset, long size) - Specified by:
createFileUploadin interfaceHttpDataFactory- Parameters:
request- associated requestsize- the size of the Uploaded file- Returns:
- a new FileUpload
-
removeHttpDataFromClean
Description copied from interface:HttpDataFactoryRemove the given InterfaceHttpData from clean list (will not delete the file, except if the file is still a temporary one as setup at construction)- Specified by:
removeHttpDataFromCleanin interfaceHttpDataFactory- Parameters:
request- associated request
-
cleanRequestHttpData
Description copied from interface:HttpDataFactoryRemove all InterfaceHttpData from virtual File storage from clean list for the request- Specified by:
cleanRequestHttpDatain interfaceHttpDataFactory- Parameters:
request- associated request
-
cleanAllHttpData
public void cleanAllHttpData()Description copied from interface:HttpDataFactoryRemove all InterfaceHttpData from virtual File storage from clean list for all requests- Specified by:
cleanAllHttpDatain interfaceHttpDataFactory
-
cleanRequestHttpDatas
- Specified by:
cleanRequestHttpDatasin interfaceHttpDataFactory
-
cleanAllHttpDatas
public void cleanAllHttpDatas()- Specified by:
cleanAllHttpDatasin interfaceHttpDataFactory
-