|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mule.module.apikit.RestContentTypeParser
public final class RestContentTypeParser
MIME-Type Parser
This class provides basic functions for handling mime-types. It can handle matching mime-types against a list of media-ranges. See section 14.1 of the HTTP specification [RFC 2616] for a complete explanation. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 A port to Java of Joe Gregorio's MIME-Type Parser: http://code.google.com/p/mimeparse/
| Nested Class Summary | |
|---|---|
protected static class |
RestContentTypeParser.FitnessAndQuality
Structure for holding a fitness/quality combo |
protected static class |
RestContentTypeParser.ParseResults
Parse results container |
| Method Summary | |
|---|---|
static com.google.common.net.MediaType |
bestMatch(List<org.raml.model.MimeType> supportedRepresentations,
String header)
Takes a list of supportedRepresentations mime-types and finds the best match for all the media-ranges listed in header. |
protected static RestContentTypeParser.FitnessAndQuality |
fitnessAndQualityParsed(com.google.common.net.MediaType target,
List<com.google.common.net.MediaType> parsedRanges)
Deprecated. used by apikit1 only |
protected static RestContentTypeParser.FitnessAndQuality |
fitnessAndQualityParsed(String mimeType,
Collection<RestContentTypeParser.ParseResults> parsedRanges)
Find the best match for a given mimeType against a list of media_ranges that have already been parsed by MimeParse.parseMediaRange(). |
static boolean |
isMediaTypeAcceptable(List<com.google.common.net.MediaType> acceptContentTypes,
com.google.common.net.MediaType mediaType)
|
protected static RestContentTypeParser.ParseResults |
parseMediaRange(String range)
Carves up a media range and returns a ParseResults. |
protected static RestContentTypeParser.ParseResults |
parseMimeType(String mimeType)
Carves up a mime-type and returns a ParseResults object For example, the media range 'application/xhtml;q=0.5' would get parsed into: ('application', 'xhtml', {'q', '0.5'}) |
static float |
quality(com.google.common.net.MediaType mimeType,
List<com.google.common.net.MediaType> ranges)
Returns the quality 'q' of a mime-type when compared against the mediaRanges in ranges. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
protected static RestContentTypeParser.ParseResults parseMimeType(String mimeType)
protected static RestContentTypeParser.ParseResults parseMediaRange(String range)
range -
protected static RestContentTypeParser.FitnessAndQuality fitnessAndQualityParsed(com.google.common.net.MediaType target,
List<com.google.common.net.MediaType> parsedRanges)
target - parsedRanges -
protected static RestContentTypeParser.FitnessAndQuality fitnessAndQualityParsed(String mimeType,
Collection<RestContentTypeParser.ParseResults> parsedRanges)
mimeType - parsedRanges -
public static float quality(com.google.common.net.MediaType mimeType,
List<com.google.common.net.MediaType> ranges)
mimeType -
public static com.google.common.net.MediaType bestMatch(List<org.raml.model.MimeType> supportedRepresentations,
String header)
supportedRepresentations - header -
public static boolean isMediaTypeAcceptable(List<com.google.common.net.MediaType> acceptContentTypes,
com.google.common.net.MediaType mediaType)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||