Class NegotiatedFormat


  • public final class NegotiatedFormat
    extends java.lang.Object
    Map between media type and format This class is immutable.
    Author:
    davidc
    • Constructor Detail

      • NegotiatedFormat

        public NegotiatedFormat​(MediaType mediaType,
                                java.lang.String format)
        Construct
        Parameters:
        mediaType - MediaType
        format - String
    • Method Detail

      • getMediaType

        public MediaType getMediaType()
        Returns:
        media type
      • getFormat

        public java.lang.String getFormat()
        Returns:
        format
      • negotiateFormat

        public static java.lang.String negotiateFormat​(java.lang.String accept,
                                                       NegotiatedFormat[] negotiatedFormats)
        Negotiate Format - given a list of accepted media types, return the format that's most suitable
        Parameters:
        accept - comma-seperated list of accepted media types
        negotiatedFormats - list of available formats
        Returns:
        most suitable format (or null, if none)