Class FileUploadUtil
java.lang.Object
io.netty.handler.codec.http.multipart.FileUploadUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleancheckContentTypeForMultiPart(String contentType, boolean throwIfInvalid) (package private) static intcompareTo(FileUpload upload1, FileUpload upload2) (package private) static booleanequals(FileUpload upload1, FileUpload upload2) (package private) static inthashCode(FileUpload upload) (package private) static booleanisContentTypeForMultiPartValid(String contentType) Determine if the given content type value is syntactically valid and well-formed.(package private) static StringvalidateContentTypeForMultiPart(String contentType) Control characters and the DEL character are either disallowed or strongly discouraged in theContent-Type.(package private) static StringvalidateFileNameForMultiPart(String filename) Control characters, the DEL character, double-quote, and backslash are either disallowed or strongly discouraged, depending on whichmultipart/form-dataspecification you read.
-
Constructor Details
-
FileUploadUtil
private FileUploadUtil()
-
-
Method Details
-
hashCode
-
equals
-
compareTo
-
validateFileNameForMultiPart
Control characters, the DEL character, double-quote, and backslash are either disallowed or strongly discouraged, depending on whichmultipart/form-dataspecification you read. This method conservatively rejects all of them, and is used for outbound (encoding) filenames.- Parameters:
filename- The filename to check.- Returns:
- The validated filename, unchanged.
-
validateContentTypeForMultiPart
Control characters and the DEL character are either disallowed or strongly discouraged in theContent-Type. Space and tab is allowed except for the first character, quotation and other special characters are allowed.The Content-Type value MUST be structured in the form of
type/subtype parameters. See RFC 9110 §8.3.1, and RFC 2045 §5.1.This is used for multipart encoding, so we refuse to emit a malformed content type.
- Parameters:
contentType- The Content-Type header value to check.- Returns:
- The valid Content-Type header value, unchanged.
-
isContentTypeForMultiPartValid
Determine if the given content type value is syntactically valid and well-formed.The Content-Type value is valid if it is structured in the form of
type/subtype parameters. See RFC 9110 §8.3.1, and RFC 2045 §5.1.This is used for multipart decoding, where RFC 2045 §5.2 recommends that syntactically invalid content type values be replaced with a default.
- Parameters:
contentType- The Content-Type header value to check.- Returns:
trueif the Content-Type header value is valid, otherwisefalse.
-
checkContentTypeForMultiPart
-