de.fuberlin.wiwiss.pubby.negotiation
Class ContentTypeNegotiator
java.lang.Object
de.fuberlin.wiwiss.pubby.negotiation.ContentTypeNegotiator
public class ContentTypeNegotiator
- extends Object
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ContentTypeNegotiator
public ContentTypeNegotiator()
addVariant
public ContentTypeNegotiator.VariantSpec addVariant(String mediaType)
setDefaultAccept
public void setDefaultAccept(String accept)
- Sets an Accept header to be used as the default if a client does
not send an Accept header, or if the Accept header cannot be parsed.
Defaults to "* / *".
addUserAgentOverride
public void addUserAgentOverride(Pattern userAgentString,
String originalAcceptHeader,
String newAcceptHeader)
- Overrides the Accept header for certain user agents. This can be
used to implement special-case handling for user agents that send
faulty Accept headers.
- Parameters:
userAgentString
- A pattern to be matched against the User-Agent header;
null means regardless of User-AgentoriginalAcceptHeader
- Only override the Accept header if the user agent
sends this header; null means always overridenewAcceptHeader
- The Accept header to be used instead
getBestMatch
public MediaRangeSpec getBestMatch(String accept)
getBestMatch
public MediaRangeSpec getBestMatch(String accept,
String userAgent)