org.milyn.profile
Class HttpAcceptHeaderProfile
java.lang.Object
org.milyn.profile.BasicProfile
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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HttpAcceptHeaderProfile
public HttpAcceptHeaderProfile(String media,
String[] params)
- Public constructor.
- Parameters:
media - Accept media (media-range).params - Accept parameters.
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.