Class DefaultHttpDataFactory
java.lang.Object
org.jboss.netty.handler.codec.http.multipart.DefaultHttpDataFactory
- All Implemented Interfaces:
HttpDataFactory
Default factory giving Attribute and FileUpload according to constructor
Attribute and FileUpload could be :
- MemoryAttribute, DiskAttribute or MixedAttribute
- MemoryFileUpload, DiskFileUpload or MixedFileUpload
according to the constructor.
- MemoryAttribute, DiskAttribute or MixedAttribute
- MemoryFileUpload, DiskFileUpload or MixedFileUpload
according to the constructor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate longstatic final longProposed default MAXSIZE = -1 as UNLIMITEDprivate longstatic final longProposed default MINSIZE as 16 KB.private final Map<HttpRequest, List<HttpData>> Keep all HttpDatas until cleanAllHttpDatas() is called.private final boolean -
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 False.DefaultHttpDataFactory(long minSize) HttpData will be on Disk if the size of the file is greater than minSize, else it will be in memory. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckHttpDataSize(HttpData data) Utility methodvoidRemove all InterfaceHttpData from virtual File storage from clean list for all requestsvoidcleanRequestHttpDatas(HttpRequest request) Remove all InterfaceHttpData from virtual File storage from clean list for the requestcreateAttribute(HttpRequest request, String name) createAttribute(HttpRequest request, String name, String value) createFileUpload(HttpRequest request, String name, String filename, String contentType, String contentTransferEncoding, Charset charset, long size) getList(HttpRequest request) 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)voidsetMaxLimit(long max) 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:
-
useDisk
private final boolean useDisk -
checkSize
private final boolean checkSize -
minSize
private long minSize -
maxSize
private long maxSize -
requestFileDeleteMap
Keep all HttpDatas until cleanAllHttpDatas() is called.
-
-
Constructor Details
-
DefaultHttpDataFactory
public DefaultHttpDataFactory()HttpData will be in memory if less than default size (16KB). No limit setup. The type will be Mixed. -
DefaultHttpDataFactory
public DefaultHttpDataFactory(boolean useDisk) HttpData will be always on Disk if useDisk is True, else always in Memory if False. No limit setup. -
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. No limit setup.
-
-
Method Details
-
setMaxLimit
public void setMaxLimit(long max) 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- Parameters:
max-
-
getList
- Returns:
- the associated list of Files for the request
-
createAttribute
- Specified by:
createAttributein interfaceHttpDataFactory- Parameters:
request- associated request- Returns:
- a new Attribute with no value
-
checkHttpDataSize
-
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
-
cleanRequestHttpDatas
Description copied from interface:HttpDataFactoryRemove all InterfaceHttpData from virtual File storage from clean list for the request- Specified by:
cleanRequestHttpDatasin interfaceHttpDataFactory- Parameters:
request- associated request
-
cleanAllHttpDatas
public void cleanAllHttpDatas()Description copied from interface:HttpDataFactoryRemove all InterfaceHttpData from virtual File storage from clean list for all requests- Specified by:
cleanAllHttpDatasin interfaceHttpDataFactory
-