Package com.aspectran.web.support.http
Class MediaTypeUtils
- java.lang.Object
-
- com.aspectran.web.support.http.MediaTypeUtils
-
public abstract class MediaTypeUtils extends java.lang.ObjectThis class is a clone of org.springframework.util.MimeTypeUtils
MiscellaneousMediaTypeutility methods.- Author:
- Arjen Poutsma, Rossen Stoyanchev, Dimitrios Liapis, Brian Clozel
-
-
Constructor Summary
Constructors Constructor Description MediaTypeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static MediaTypeparseMediaType(java.lang.String mediaType)Parse the given String into a singleMediaType.static java.util.List<java.lang.String>tokenize(java.lang.String mediaTypes)Tokenize the given comma-separated string ofMediaTypeobjects into aList<String>.static java.lang.StringtoString(java.util.Collection<MediaType> mediaTypes)Return a string representation of the given list ofMediaTypeobjects.
-
-
-
Method Detail
-
parseMediaType
protected static MediaType parseMediaType(java.lang.String mediaType)
Parse the given String into a singleMediaType. Recently parsedMediaTypeare cached for further retrieval.- Parameters:
mediaType- the string to parse- Returns:
- the media type
- Throws:
InvalidMediaTypeException- if the string cannot be parsed
-
tokenize
public static java.util.List<java.lang.String> tokenize(java.lang.String mediaTypes)
Tokenize the given comma-separated string ofMediaTypeobjects into aList<String>. Unlike simple tokenization by ",", this method takes into account quoted parameters.- Parameters:
mediaTypes- the string to tokenize- Returns:
- the list of tokens
-
toString
public static java.lang.String toString(java.util.Collection<MediaType> mediaTypes)
Return a string representation of the given list ofMediaTypeobjects.- Parameters:
mediaTypes- the string to parse- Returns:
- the list of media types
- Throws:
java.lang.IllegalArgumentException- if the String cannot be parsed
-
-