org.springframework.extensions.webscripts
Class NegotiatedFormat

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

public final class NegotiatedFormat
extends Object

Map between media type and format This class is immutable.

Author:
davidc

Constructor Summary
NegotiatedFormat(MediaType mediaType, String format)
          Construct
 
Method Summary
 String getFormat()
           
 MediaType getMediaType()
           
static String negotiateFormat(String accept, NegotiatedFormat[] negotiatedFormats)
          Negotiate Format - given a list of accepted media types, return the format that's most suitable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NegotiatedFormat

public NegotiatedFormat(MediaType mediaType,
                        String format)
Construct

Parameters:
mediaType -
format -
Method Detail

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)


Copyright © 2009 SpringSource, Inc. All Rights Reserved.