Class AcceptList


  • public class AcceptList
    extends java.lang.Object
    • Constructor Detail

      • AcceptList

        public AcceptList​(java.util.List<MediaRange> mediaRanges)
        Create a list of accept items from the give strings.
        Parameters:
        mediaRanges -
      • AcceptList

        public AcceptList​(MediaRange... acceptItems)
        Create a list of accept items from the give MediaTypes.
        Parameters:
        acceptItems -
      • AcceptList

        public AcceptList​(java.lang.String headerString)
        Parse an HTTP Accept (or etc) header string.
        Parameters:
        headerString -
    • Method Detail

      • create

        public static AcceptList create​(MediaType... acceptItems)
        Create a list of accept items from the give MediaTypes.
        Parameters:
        acceptItems -
      • create

        public static AcceptList create​(java.lang.String... acceptStrings)
        Create a list of accept items from strings.
        Parameters:
        acceptStrings -
      • entries

        public java.util.List<MediaRange> entries()
      • match

        public MediaRange match​(MediaType offer)
        Find and return a match for a specific MediaType. Returns the Accept header entry best matched or null.
      • match

        public static MediaType match​(AcceptList proposalList,
                                      AcceptList offerList)
        Find the best thing in offer list 8sever side) matching the proposal (client, Accept header). "best" means highest q value, with left most being better for same q.
        Parameters:
        proposalList - Client list of possibilities
        offerList - Server list of possibilities
        Returns:
        MediaType
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object