Class FileUploadUtil
java.lang.Object
io.netty.handler.codec.http.multipart.FileUploadUtil
final class FileUploadUtil
extends java.lang.Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleancheckContentTypeForMultiPart(java.lang.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(java.lang.String contentType) Determine if the given content type value is syntactically valid and well-formed.(package private) static java.lang.StringvalidateContentTypeForMultiPart(java.lang.String contentType) Control characters and the DEL character are either disallowed or strongly discouraged in theContent-Type.(package private) static java.lang.StringvalidateFileNameForMultiPart(java.lang.String filename) Control characters, the DEL character, double-quote, and backslash are either disallowed or strongly discouraged, depending on whichmultipart/form-dataspecification you read.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
FileUploadUtil
private FileUploadUtil()
-
-
Method Details
-
hashCode
-
equals
-
compareTo
-
validateFileNameForMultiPart
static java.lang.String validateFileNameForMultiPart(java.lang.String filename) 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
static java.lang.String validateContentTypeForMultiPart(java.lang.String contentType) 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
static boolean isContentTypeForMultiPartValid(java.lang.String contentType) 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
private static boolean checkContentTypeForMultiPart(java.lang.String contentType, boolean throwIfInvalid)
-