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

public class MediaType extends Object
Represents a MediaType as described at http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
  • Constructor Details

    • MediaType

      public MediaType(String mediatype)
      Construct
      Parameters:
      mediatype - string representation of mediatype e.g. text/html;level=1;q=0.8
  • Method Details

    • getType

      public String getType()
      Returns:
      type
    • getSubtype

      public String getSubtype()
      Returns:
      subtype
    • getParams

      public String getParams()
      Returns:
      params
    • getQuality

      public float getQuality()
      Returns:
      quality factory
    • compare

      public float compare(MediaType to)
      Compare to another media type
      Parameters:
      to - media type to compare to
      Returns:
      score representing how close a match the compared media types are
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • main

      public static void main(String[] args)
      Simple exampe usage
      Parameters:
      args - String[]