resetReferrerBeforeRescrape
boolean resetReferrerBeforeRescrape ( )
Description
Returns true if the referrer should be reset before attempting to rescrape the file, if there was an error. This can be useful to reset so the referrer doesn't show the page you just requested.
Parameters
This method takes no parameters
Return Value
True if the referrer should be reset if there was an error, false otherwise.
Change Log
Version |
Description |
6.0.36a |
Available in all editions. |
Examples
Create a custom RetryPolicy
import com.screenscraper.util.retry.RetryPolicy;
_log = log;
_session = session;
RetryPolicy policy = new RetryPolicy()
{
Map errorMap = new HashMap();
boolean isError() throws Exception
{
errorMap.put("Was Error On Request", scrapeableFile.wasErrorOnRequest());
return scrapeableFile.wasErrorOnRequest();
}
void runOnError() throws Exception
{
session.executeScript("Rotate Proxy");
}
Map getErrorChecksMap() throws Exception
{
return errorMap;
}
boolean resetSessionVariablesBeforeRescrape()
{
return true;
}
boolean shouldLogErrors()
{
return true;
}
int getMaxRetryAttempts()
{
return 5;
}
boolean resetReferrerBeforeRescrape()
{
return false;
}
void runOnAllAttemptsFailed()
{
_log.logError("Failed to fix errors with the retry policy, stopping scrape");
_session.stopScraping();
}
};
scrapeableFile.setRetryPolicy(policy);