Creates a copy of the current instance with the specified parameters.
Parameters associated with this instance.
Raw string representation of the media type, ignoring parameters.
Allows instances of MediaType to be used in pattern matching.
Allows instances of MediaType to be used in pattern matching.
Matches depend on the MediaType implementation. Instances of MediaType.Specific, for example, will only match parameters that have the same main- and sub-type, while instances of MediaType.Range will match any type that shares a main-type.
This method ignores media type parameters.
Returns the charset associated with this media type (charset
parameter).
Sets the charset associated with this media type (charset
parameter).
Returns the value of the requested parameter.
Returns the value of the requested parameter.
This is strictly a convenience method and will simply call the underlying parameter's MediaTypeParameters.getOpt method.
Sets the specified parameter to the specified value.
Removes the specified parameter.
Convenience method that behaves exactly as MediaType.unapply on instances of Response.
Convenience method that behaves exactly as MediaType.unapply on instances of Response.
This is meant to make mapping on instances Request more convenient:
val req: Request[Response[ResponseEntity]] = ??? req.map { case res @ MediaType.Text(_) => println("Text content: " + res.body.as[String]) case MediaType(m) => println("Unsupported media type: " + m) }