com.norconex.collector.http.handler.impl
Class SimpleHttpHeadersFetcher
java.lang.Object
com.norconex.collector.http.handler.impl.SimpleHttpHeadersFetcher
- All Implemented Interfaces:
- IHttpHeadersFetcher, IXMLConfigurable, Serializable
public class SimpleHttpHeadersFetcher
- extends Object
- implements IHttpHeadersFetcher, IXMLConfigurable
Basic implementation of IHttpHeadersFetcher
.
XML configuration usage:
<httpHeadersFetcher
class="com.norconex.collector.http.handler.impl.SimpleHttpHeadersFetcher" >
<validStatusCodes>200</validStatusCodes>
<headersPrefix>(string to prefix headers)</headersPrefix>
</httpHeadersFetcher>
The "validStatusCodes" attribute expects a coma-separated list of HTTP
response code.
- Author:
- Pascal Essiembre
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_VALID_STATUS_CODES
public static final int[] DEFAULT_VALID_STATUS_CODES
SimpleHttpHeadersFetcher
public SimpleHttpHeadersFetcher()
SimpleHttpHeadersFetcher
public SimpleHttpHeadersFetcher(int[] validStatusCodes)
getValidStatusCodes
public int[] getValidStatusCodes()
setValidStatusCodes
public void setValidStatusCodes(int[] validStatusCodes)
getHeadersPrefix
public String getHeadersPrefix()
setHeadersPrefix
public void setHeadersPrefix(String headersPrefix)
fetchHTTPHeaders
public Properties fetchHTTPHeaders(org.apache.http.impl.client.DefaultHttpClient httpClient,
String url)
- Description copied from interface:
IHttpHeadersFetcher
- Returning
null
means the headers could not be fetched
and the associated document will be skipped (treated as rejected).
- Specified by:
fetchHTTPHeaders
in interface IHttpHeadersFetcher
- Parameters:
httpClient
- the HTTP Clienturl
- the url from which to fetch the headers
- Returns:
- HTTP headers as metadata
loadFromXML
public void loadFromXML(Reader in)
- Specified by:
loadFromXML
in interface IXMLConfigurable
saveToXML
public void saveToXML(Writer out)
throws IOException
- Specified by:
saveToXML
in interface IXMLConfigurable
- Throws:
IOException
Copyright © 2009-2013 Norconex Inc.. All Rights Reserved.