|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.servlet.mvc.condition.AbstractRequestCondition<ProducesRequestCondition> org.springframework.web.servlet.mvc.condition.ProducesRequestCondition
public final class ProducesRequestCondition
A logical disjunction (' || ') request condition to match a request's 'Accept' header
to a list of media type expressions. Two kinds of media type expressions are
supported, which are described in RequestMapping.produces()
and
RequestMapping.headers()
where the header name is 'Accept'.
Regardless of which syntax is used, the semantics are the same.
Constructor Summary | |
---|---|
ProducesRequestCondition(String... produces)
Creates a new instance from 0 or more "produces" expressions. |
|
ProducesRequestCondition(String[] produces,
String[] headers)
Creates a new instance with "produces" and "header" expressions. |
Method Summary | |
---|---|
ProducesRequestCondition |
combine(ProducesRequestCondition other)
Returns the "other" instance if it has any expressions; returns "this" instance otherwise. |
int |
compareTo(ProducesRequestCondition other,
HttpServletRequest request)
Compares this and another "produces" condition as follows: Sort 'Accept' header media types by quality value via MediaType.sortByQualityValue(List) and iterate the list. |
protected List<org.springframework.web.servlet.mvc.condition.ProducesRequestCondition.ProduceMediaTypeExpression> |
getContent()
Return the discrete items a request condition is composed of. |
Set<MediaTypeExpression> |
getExpressions()
Return the contained "produces" expressions. |
ProducesRequestCondition |
getMatchingCondition(HttpServletRequest request)
Checks if any of the contained media type expressions match the given request 'Content-Type' header and returns an instance that is guaranteed to contain matching expressions only. |
Set<MediaType> |
getProducibleMediaTypes()
Return the contained producible media types excluding negated expressions. |
protected String |
getToStringInfix()
The notation to use when printing discrete items of content. |
boolean |
isEmpty()
Whether the condition has any media type expressions. |
Methods inherited from class org.springframework.web.servlet.mvc.condition.AbstractRequestCondition |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ProducesRequestCondition(String... produces)
produces
- expressions with the syntax described in RequestMapping.produces()
if 0 expressions are provided, the condition matches to every requestpublic ProducesRequestCondition(String[] produces, String[] headers)
produces
- expressions with the syntax described in RequestMapping.produces()
headers
- expressions with the syntax described in RequestMapping.headers()
Method Detail |
---|
public Set<MediaTypeExpression> getExpressions()
public Set<MediaType> getProducibleMediaTypes()
public boolean isEmpty()
protected List<org.springframework.web.servlet.mvc.condition.ProducesRequestCondition.ProduceMediaTypeExpression> getContent()
AbstractRequestCondition
getContent
in class AbstractRequestCondition<ProducesRequestCondition>
null
protected String getToStringInfix()
AbstractRequestCondition
getToStringInfix
in class AbstractRequestCondition<ProducesRequestCondition>
public ProducesRequestCondition combine(ProducesRequestCondition other)
other
- the condition to combine with.public ProducesRequestCondition getMatchingCondition(HttpServletRequest request)
MediaType.isCompatibleWith(MediaType)
.
request
- the current request
null
if no expressions match.public int compareTo(ProducesRequestCondition other, HttpServletRequest request)
MediaType.sortByQualityValue(List)
and iterate the list.
MediaType.equals(Object)
and
then with MediaType.includes(MediaType)
.
MediaType.SPECIFICITY_COMPARATOR
.
It is assumed that both instances have been obtained via
getMatchingCondition(HttpServletRequest)
and each instance
contains the matching producible media type expression only or
is otherwise empty.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |