Package org.restlet.data
Class Conditions
- java.lang.Object
-
- org.restlet.data.Conditions
-
public final class Conditions extends java.lang.Object
Set of conditions applying to a request. This is equivalent to the HTTP conditional headers.- Author:
- Jerome Louvel
- See Also:
- If-Match, If-Modified-Since, If-None-Match, If-Range, If-Unmodified-Since
-
-
Constructor Summary
Constructors Constructor Description Conditions()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Tag>
getMatch()
Returns the modifiable list of tags that must be matched.java.util.Date
getModifiedSince()
Returns the condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Modified-Since" header.java.util.List<Tag>
getNoneMatch()
Returns the modifiable list of tags that mustn't match.java.util.Date
getRangeDate()
Returns the range condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Range" header.Status
getRangeStatus(Tag tag, java.util.Date modificationDate)
Returns the range conditional status of an entity.Status
getRangeStatus(RepresentationInfo representationInfo)
Returns the range conditional status of an entity.Tag
getRangeTag()
Returns the range condition based on the entity tag of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Range" header.Status
getStatus(Method method, boolean entityExists, Tag tag, java.util.Date modificationDate)
Returns the conditional status of a variant using a given method.Status
getStatus(Method method, RepresentationInfo representationInfo)
Returns the conditional status of a variant using a given method.java.util.Date
getUnmodifiedSince()
Returns the condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Unmodified-Since" header.boolean
hasSome()
Indicates if there are some conditions set.boolean
hasSomeRange()
Indicates if there are some range conditions set.void
setMatch(java.util.List<Tag> tags)
Sets the modifiable list of tags that must be matched.
Note that when used with HTTP connectors, this property maps to the "If-Match" header.void
setModifiedSince(java.util.Date date)
Sets the condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Modified-Since" header.void
setNoneMatch(java.util.List<Tag> tags)
Sets the modifiable list of tags that mustn't match.void
setRangeDate(java.util.Date rangeDate)
Sets the range condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Range" header.void
setRangeTag(Tag rangeTag)
Sets the range condition based on the entity tag of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Range" header.void
setUnmodifiedSince(java.util.Date date)
Sets the condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Unmodified-Since" header.
-
-
-
Method Detail
-
getMatch
public java.util.List<Tag> getMatch()
Returns the modifiable list of tags that must be matched. Creates a new instance if no one has been set.
Note that when used with HTTP connectors, this property maps to the "If-Match" header.- Returns:
- The "if-match" condition.
-
getModifiedSince
public java.util.Date getModifiedSince()
Returns the condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Modified-Since" header.- Returns:
- The condition date.
-
getNoneMatch
public java.util.List<Tag> getNoneMatch()
Returns the modifiable list of tags that mustn't match. Creates a new instance if no one has been set.
Note that when used with HTTP connectors, this property maps to the "If-None-Match" header.- Returns:
- The list of tags that mustn't match.
-
getRangeDate
public java.util.Date getRangeDate()
Returns the range condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Range" header.- Returns:
- The range condition date.
-
getRangeStatus
public Status getRangeStatus(RepresentationInfo representationInfo)
Returns the range conditional status of an entity.- Parameters:
representationInfo
- The representation information that will be tested.- Returns:
- the status of the response.
-
getRangeStatus
public Status getRangeStatus(Tag tag, java.util.Date modificationDate)
Returns the range conditional status of an entity.- Parameters:
tag
- The tag of the entity.modificationDate
- The modification date of the entity.- Returns:
- The status of the response.
-
getRangeTag
public Tag getRangeTag()
Returns the range condition based on the entity tag of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Range" header.- Returns:
- The range entity tag.
-
getStatus
public Status getStatus(Method method, boolean entityExists, Tag tag, java.util.Date modificationDate)
Returns the conditional status of a variant using a given method.- Parameters:
method
- The request method.entityExists
- Indicates if the entity exists.tag
- The tag.modificationDate
- The modification date.- Returns:
- Null if the requested method can be performed, the status of the response otherwise.
-
getStatus
public Status getStatus(Method method, RepresentationInfo representationInfo)
Returns the conditional status of a variant using a given method.- Parameters:
method
- The request method.representationInfo
- The representation information that will be tested.- Returns:
- Null if the requested method can be performed, the status of the response otherwise.
-
getUnmodifiedSince
public java.util.Date getUnmodifiedSince()
Returns the condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Unmodified-Since" header.- Returns:
- The condition date.
-
hasSome
public boolean hasSome()
Indicates if there are some conditions set.- Returns:
- True if there are some conditions set.
-
hasSomeRange
public boolean hasSomeRange()
Indicates if there are some range conditions set.- Returns:
- True if there are some range conditions set.
-
setMatch
public void setMatch(java.util.List<Tag> tags)
Sets the modifiable list of tags that must be matched.
Note that when used with HTTP connectors, this property maps to the "If-Match" header.- Parameters:
tags
- The "if-match" condition.
-
setModifiedSince
public void setModifiedSince(java.util.Date date)
Sets the condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Modified-Since" header.- Parameters:
date
- The modification date.
-
setNoneMatch
public void setNoneMatch(java.util.List<Tag> tags)
Sets the modifiable list of tags that mustn't match. Creates a new instance if no one has been set.
Note that when used with HTTP connectors, this property maps to the "If-None-Match" header.- Parameters:
tags
- The list of tags that mustn't match.
-
setRangeDate
public void setRangeDate(java.util.Date rangeDate)
Sets the range condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Range" header.- Parameters:
rangeDate
- The date of the range condition.
-
setRangeTag
public void setRangeTag(Tag rangeTag)
Sets the range condition based on the entity tag of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Range" header.- Parameters:
rangeTag
- The entity tag of the range condition.
-
setUnmodifiedSince
public void setUnmodifiedSince(java.util.Date date)
Sets the condition based on the modification date of the requested variant.
Note that when used with HTTP connectors, this property maps to the "If-Unmodified-Since" header.- Parameters:
date
- The condition date.
-
-