org.milyn.profile
Class HttpAcceptHeaderProfile

java.lang.Object
  extended by org.milyn.profile.BasicProfile
      extended by org.milyn.profile.HttpAcceptHeaderProfile
All Implemented Interfaces:
Serializable, Profile

public class HttpAcceptHeaderProfile
extends BasicProfile

HTTP Accept header profile.

This profile implementation exposes the requesting useragent's "Accept" header media types as part of the profile set. This class represents a single media type. See RFC2068 section 14.1.

The profile name is of the form

        "accept" ":" "media-range"
 

This class also provides access to the Accept header media parameters via the getParam methods (getParam(String) and getParamNumeric(String, double)).

Author:
tfennelly
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.milyn.profile.Profile
DEFAULT_PROFILE
 
Constructor Summary
HttpAcceptHeaderProfile(String media, String[] params)
          Public constructor.
 
Method Summary
 String getParam(String name)
          Get the named parameter as a string.
 double getParamNumeric(String name, double defaultVal)
          Get the named parameter as a numeric value.
 
Methods inherited from class org.milyn.profile.BasicProfile
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpAcceptHeaderProfile

public HttpAcceptHeaderProfile(String media,
                               String[] params)
Public constructor.

Parameters:
media - Accept media (media-range).
params - Accept parameters.
Method Detail

getParam

public String getParam(String name)
Get the named parameter as a string.

Parameters:
name - Parameter name.
Returns:
Parameter value, or null if not defined.

getParamNumeric

public double getParamNumeric(String name,
                              double defaultVal)
                       throws NumberFormatException
Get the named parameter as a numeric value.

Use this method for extracting

Parameters:
name - Parameter name.
Returns:
Parameter value as a float, or defaultVal if not defined.
Throws:
NumberFormatException - The requested parameter value is a not a numeric value.


Copyright © 2018. All rights reserved.