|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.any23.servlet.conneg.ContentTypeNegotiator
public class ContentTypeNegotiator
This class defines a negotiator for content types based on scoring.
Nested Class Summary | |
---|---|
protected class |
ContentTypeNegotiator.VariantSpec
|
Constructor Summary | |
---|---|
protected |
ContentTypeNegotiator()
|
Method Summary | |
---|---|
protected void |
addUserAgentOverride(Pattern userAgentString,
String originalAcceptHeader,
String newAcceptHeader)
Overrides the Accept header for certain user agents. |
protected ContentTypeNegotiator.VariantSpec |
addVariant(String mediaType)
|
MediaRangeSpec |
getBestMatch(String accept)
Returns the MediaRangeSpec
associated to the given accept type. |
MediaRangeSpec |
getBestMatch(String accept,
String userAgent)
Returns the MediaRangeSpec
associated to the given accept type and userAgent. |
protected 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ContentTypeNegotiator()
Method Detail |
---|
public MediaRangeSpec getBestMatch(String accept)
MediaRangeSpec
associated to the given accept type.
accept
-
MediaRangeSpec
associated to the accept parameterpublic MediaRangeSpec getBestMatch(String accept, String userAgent)
MediaRangeSpec
associated to the given accept type and userAgent.
accept
- userAgent
-
MediaRangeSpec
associated to the given accept type and userAgent.protected ContentTypeNegotiator.VariantSpec addVariant(String mediaType)
protected void setDefaultAccept(String accept)
protected void addUserAgentOverride(Pattern userAgentString, String originalAcceptHeader, String newAcceptHeader)
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |