Class NegotiatedFormat

java.lang.Object
org.springframework.extensions.webscripts.NegotiatedFormat

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

    • NegotiatedFormat

      public NegotiatedFormat(MediaType mediaType, String format)
      Construct
      Parameters:
      mediaType - MediaType
      format - String
  • Method Details

    • getMediaType

      public MediaType getMediaType()
      Returns:
      media type
    • getFormat

      public String getFormat()
      Returns:
      format
    • negotiateFormat

      public static String negotiateFormat(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)