Class MediaType
java.lang.Object
org.apache.tomcat.util.http.parser.MediaType
Represents a parsed media type.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the charset.intGet the number of parameters.getParameterValue(String parameter) Get the value of a parameter.Get the media subtype.getType()Get the media type.static MediaTypeparseMediaType(Reader input) Parses a MediaType value, either from an HTTP header or from an application.static StringparseMediaTypeOnly(String input) A simplified media type parser that removes any parameters and just returns the media type and the subtype.toString()Get the string representation without charset.
-
Constructor Details
-
MediaType
Constructor.- Parameters:
type- the media typesubtype- the media subtypeparameters- the parameters
-
-
Method Details
-
getType
-
getSubtype
-
getCharset
-
getParameterCount
public int getParameterCount()Get the number of parameters.- Returns:
- the parameter count
-
getParameterValue
-
toString
-
toStringNoCharset
Get the string representation without charset.- Returns:
- the string representation
-
parseMediaType
Parses a MediaType value, either from an HTTP header or from an application.- Parameters:
input- a reader over the header text- Returns:
- a MediaType parsed from the input, or null if not valid
- Throws:
IOException- if there was a problem reading the input
-
parseMediaTypeOnly
-