Package com.aspectran.web.support.http
Class MediaTypeUtils
- java.lang.Object
-
- com.aspectran.web.support.http.MediaTypeUtils
-
public abstract class MediaTypeUtils extends java.lang.Object
This class is a clone of org.springframework.util.MimeTypeUtils
MiscellaneousMediaType
utility 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 MediaType
parseMediaType(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 ofMediaType
objects into aList<String>
.static java.lang.String
toString(java.util.Collection<MediaType> mediaTypes)
Return a string representation of the given list ofMediaType
objects.
-
-
-
Method Detail
-
parseMediaType
protected static MediaType parseMediaType(java.lang.String mediaType)
Parse the given String into a singleMediaType
. Recently parsedMediaType
are 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 ofMediaType
objects 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 ofMediaType
objects.- Parameters:
mediaTypes
- the string to parse- Returns:
- the list of media types
- Throws:
java.lang.IllegalArgumentException
- if the String cannot be parsed
-
-