com.google.common.base.Predicate<org.apache.http.HttpResponse>, Filter<org.apache.http.HttpResponse>, FlyweightPrototype<Filter<org.apache.http.HttpResponse>>, java.util.function.Predicate<org.apache.http.HttpResponse>public class ContentTypeStartsWith extends AbstractFilter<org.apache.http.HttpResponse>
Typical usage: ContentTypeStartsWith(text/),
FILTER_PACKAGE_NAME| Constructor | Description |
|---|---|
ContentTypeStartsWith(java.lang.String prefix) |
Creates a filter that only accepts URLs whose content type starts with a given prefix.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
apply(org.apache.http.HttpResponse x) |
Apply the filter to a
HttpResponse |
Filter<org.apache.http.HttpResponse> |
copy() |
|
boolean |
equals(java.lang.Object x) |
Compare this object with a given generic one
|
int |
hashCode() |
|
java.lang.String |
toString() |
A string representation of the state of this object, that is just the prefix allowed.
|
static ContentTypeStartsWith |
valueOf(java.lang.String spec) |
Get a new
ContentTypeStartsWith that will accept only fetched responses whose content type starts with a given string |
toStringpublic ContentTypeStartsWith(java.lang.String prefix)
prefix - the prefix of the content type of the HttpResponse to be acceptedpublic boolean apply(org.apache.http.HttpResponse x)
HttpResponsex - the HttpResponse to be filteredtrue if the first header of the given HttpResponse is not null and starts with the prefixpublic static ContentTypeStartsWith valueOf(java.lang.String spec)
ContentTypeStartsWith that will accept only fetched responses whose content type starts with a given stringspec - a String, that will be used to compare prefixes.ContentTypeStartsWith that will accept only fetched response whose content type starts with specpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object x)
equals in interface com.google.common.base.Predicate<org.apache.http.HttpResponse>equals in class java.lang.Objecttrue if x is an instance of ContentTypeStartsWith and the prefix allowed by x is allowed by this and vice versapublic Filter<org.apache.http.HttpResponse> copy()
public int hashCode()
hashCode in class java.lang.Object