org.springframework.extensions.webscripts
Class MediaType

java.lang.Object
  extended by 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 Summary
MediaType(String mediatype)
          Construct
 
Method Summary
 float compare(MediaType to)
          Compare to another media type
 boolean equals(Object other)
           
 String getParams()
           
 float getQuality()
           
 String getSubtype()
           
 String getType()
           
 int hashCode()
           
static void main(String[] args)
          Simple exampe usage
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MediaType

public MediaType(String mediatype)
Construct

Parameters:
mediatype - string representation of mediatype e.g. text/html;level=1;q=0.8
Method Detail

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 -


Copyright © 2009 SpringSource, Inc. All Rights Reserved.